Mercurial > retraceit
diff src/CMakeLists.txt @ 0:147b08bc7d64
Initial commit of a basic Application framework.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 23 Mar 2015 12:41:52 +0100 |
parents | |
children | 7a2637c3eb83 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/CMakeLists.txt Mon Mar 23 12:41:52 2015 +0100 @@ -0,0 +1,92 @@ +# Copyright (C) 2014 by Intevation GmbH +# +# This file is Free Software under the GNU GPL (v>=2) +# and comes with ABSOLUTELY NO WARRANTY! +# See LICENSE.txt for details. + +include_directories(${Qt5Widgets_INCLUDE_DIRS}) + +include_directories(${CMAKE_CURRENT_SOURCE_DIR}) + +add_definitions(${Qt5Widgets_DEFINITIONS}) + +set(APPLICATION_SRC + main.cpp + mainwindow.cpp + strhelp.c + util_win.c + util_linux.c +) + +find_package(Qt5LinguistTools) + +if(UNIX) + # See: https://bugreports.qt-project.org/browse/QTBUG-35918 + # XCB_EXTRA_LIBS should be gotten automatically. + # The following list is taken from the .pri file + get_target_property(_loc Qt5::Widgets LOCATION) + get_filename_component(_qtpath ${_loc} PATH) + + set(XCB_EXTRA_LIBS + -L${_qtpath} + -lQt5DBus -lQt5Gui -lQt5Core -lQt5PlatformSupport + -lX11 -lX11-xcb -lxcb + -lXrender -lSM -lICE -ldbus-1 + -lm -ldl -lrt -lpthread ) + +elseif(WIN32) + set (_add_executable_params WIN32) + + get_target_property(_loc Qt5::Widgets LOCATION) + get_filename_component(_qtpath ${_loc} PATH) + set(WINDOWS_EXTRA_LIBS + -L${_qtpath} + -lwinspool -lshlwapi + -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm + -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32 + -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16 -lz) + + set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS}) +endif() + +set(QT_RESOURCES + ${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc + # ${CMAKE_SOURCE_DIR}/img/icons.qrc +) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}") +qt5_add_resources(APPLICATION_SRC ${QT_RESOURCES}) + +if(Qt5LinguistTools_FOUND) + + set(FILES_TO_TRANSLATE + ${APPLICATION_SRC} + ) + + # Include translation as a resource + # This works in the source directory to enable the rcc dependencies to be found + # and it also updates the currently available localization. + configure_file(l10n/l10n.qrc.in l10n.qrc) + qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc) + qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE} + ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts) +endif() + +add_executable(${PROJECT_NAME} + ${_add_executable_params} + # ${IMG_SRC} + ${APPLICATION_SRC} + ${TRANSLATION_SRC} + # ${CMAKE_SOURCE_DIR}/img/icon.rc + ) + + +target_link_libraries(${PROJECT_NAME} + Qt5::Widgets + ${EXTRA_STATIC_LIBS}) + +if (WIN32) + set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode") +endif(WIN32) + +install(TARGETS ${PROJECT_NAME} DESTINATION bin)