Commit 65e31c10 authored by Thomas Friedrichsmeier's avatar Thomas Friedrichsmeier
Browse files

More fixes and workarouns for MSVC

parent b45bb9fe
......@@ -22,13 +22,21 @@ INCLUDE(FeatureSummary)
FIND_PACKAGE(Qt5 5.2 CONFIG REQUIRED COMPONENTS Widgets Core Xml Network WebKit Script PrintSupport)
FIND_PACKAGE(KF5 5.2 REQUIRED COMPONENTS CoreAddons DocTools I18n XmlGui TextEditor WidgetsAddons WebKit Parts Config Notifications WindowSystem)
FIND_PACKAGE(Gettext REQUIRED)
if("${CMAKE_VERSION}" VERSION_GREATER 3.2.3)
FIND_PACKAGE(Intl REQUIRED)
# FindIntl in cmake is broken for MSVC on Windows, (and only included from 3.2.3 upwards).
# Borrowing some code from ki18n instead (originally BSD licensed, copyright Copyright 2014 Alex Richardson <arichardson.kde@gmail.com>)
FIND_PATH(LibIntl_INCLUDE_DIRS NAMES libintl.h)
FIND_LIBRARY(LibIntl_LIBRARIES NAMES intl libintl)
INCLUDE(CheckCXXSymbolExists)
CHECK_CXX_SYMBOL_EXISTS(dngettext libintl.h LibIntl_SYMBOL_FOUND)
INCLUDE(FindPackageHandleStandardArgs)
IF(LibIntl_SYMBOL_FOUND)
MESSAGE(STATUS "libintl is part of libc, no extra library is required.")
SET(LibIntl_LIBRARIES "")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibIntl REQUIRED_VARS LibIntl_INCLUDE_DIRS)
ELSE()
# Note: this may or may not work (it does not on Windows), but is worth a try:
IF(NOT ${Intl_LIBRARIES})
SET(Intl_LIBRARIES ${GETTEXT_LIBRARIES})
ENDIF(NOT ${Intl_LIBRARIES})
MESSAGE(STATUS "libintl is a separate library.")
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LibIntl REQUIRED_VARS LibIntl_INCLUDE_DIRS LibIntl_LIBRARIES)
ENDIF()
IF(FORCE_PRETTY_MAKEFILE)
......
......@@ -53,7 +53,7 @@ IF(Q_WS_MAC)
@ONLY)
ENDIF(Q_WS_MAC)
TARGET_LINK_LIBRARIES(rkward.frontend windows ${RKWARD_ADDLIBS} agents dialogs plugin settings dataeditor core scriptbackends rbackend misc KF5::WindowSystem Qt5::Widgets KF5::XmlGui ${Intl_LIBRARIES})
TARGET_LINK_LIBRARIES(rkward.frontend windows ${RKWARD_ADDLIBS} agents dialogs plugin settings dataeditor core scriptbackends rbackend misc KF5::WindowSystem Qt5::Widgets KF5::XmlGui ${LibIntl_LIBRARIES})
# wrapper executable
GET_DIRECTORY_PROPERTY(R_EXECUTABLE DIRECTORY rbackend DEFINITION R_EXECUTABLE)
......
......@@ -124,7 +124,7 @@ int main (int argc, char *argv[]) {
// before initializing the commandline args, remove the ".bin" from "rkward.bin".
// This is so it prints "Usage rkward..." instead of "Usage rkward.bin...", etc.
// it seems safest to keep a copy, since the shell still owns argv
char *argv_copy[argc];
char **argv_copy = new char*[argc];
argv_copy[0] = qstrdup (QString (argv[0]).remove (".frontend").replace (".exe", ".bat").toLocal8Bit ());
for (int i = 1; i < argc; ++i) {
argv_copy[i] = argv[i];
......@@ -217,6 +217,7 @@ int main (int argc, char *argv[]) {
qInstallMessageHandler (0);
RKSettingsModuleDebug::debug_file->close ();
delete argv_copy;
return status;
}
......@@ -56,7 +56,7 @@ SET (
ADD_DEFINITIONS (-DRKWARD_SPLIT_PROCESS)
LINK_DIRECTORIES(${R_SHAREDLIBDIR})
ADD_EXECUTABLE(rkward.rbackend ${rbackend_BACKEND_SRCS})
TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} Qt5::Network Qt5::Core ${Intl_LIBRARIES} )
TARGET_LINK_LIBRARIES(rkward.rbackend rkgraphicsdevice.backend ${R_USED_LIBS} ${CMAKE_THREAD_LIBS_INIT} Qt5::Network Qt5::Core ${LibIntl_LIBRARIES})
IF(WIN32)
# on Widows, we install to the rbackend subdirectory, because 1) LIBEXEC_INSTALL_DIR == BIN_INSTALL_DIR and 2) we don't want the backend to pick up
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment