comparison 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
comparison
equal deleted inserted replaced
-1:000000000000 0:147b08bc7d64
1 # Copyright (C) 2014 by Intevation GmbH
2 #
3 # This file is Free Software under the GNU GPL (v>=2)
4 # and comes with ABSOLUTELY NO WARRANTY!
5 # See LICENSE.txt for details.
6
7 include_directories(${Qt5Widgets_INCLUDE_DIRS})
8
9 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
10
11 add_definitions(${Qt5Widgets_DEFINITIONS})
12
13 set(APPLICATION_SRC
14 main.cpp
15 mainwindow.cpp
16 strhelp.c
17 util_win.c
18 util_linux.c
19 )
20
21 find_package(Qt5LinguistTools)
22
23 if(UNIX)
24 # See: https://bugreports.qt-project.org/browse/QTBUG-35918
25 # XCB_EXTRA_LIBS should be gotten automatically.
26 # The following list is taken from the .pri file
27 get_target_property(_loc Qt5::Widgets LOCATION)
28 get_filename_component(_qtpath ${_loc} PATH)
29
30 set(XCB_EXTRA_LIBS
31 -L${_qtpath}
32 -lQt5DBus -lQt5Gui -lQt5Core -lQt5PlatformSupport
33 -lX11 -lX11-xcb -lxcb
34 -lXrender -lSM -lICE -ldbus-1
35 -lm -ldl -lrt -lpthread )
36
37 elseif(WIN32)
38 set (_add_executable_params WIN32)
39
40 get_target_property(_loc Qt5::Widgets LOCATION)
41 get_filename_component(_qtpath ${_loc} PATH)
42 set(WINDOWS_EXTRA_LIBS
43 -L${_qtpath}
44 -lwinspool -lshlwapi
45 -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm
46 -lglu32 -lopengl32 -lgdi32 -lQt5Core -lole32 -lmstask -luuid -lws2_32
47 -ladvapi32 -lshell32 -luser32 -lkernel32 -lpcre16 -lz)
48
49 set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS})
50 endif()
51
52 set(QT_RESOURCES
53 ${CMAKE_CURRENT_SOURCE_DIR}/fonts.qrc
54 # ${CMAKE_SOURCE_DIR}/img/icons.qrc
55 )
56
57 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
58 qt5_add_resources(APPLICATION_SRC ${QT_RESOURCES})
59
60 if(Qt5LinguistTools_FOUND)
61
62 set(FILES_TO_TRANSLATE
63 ${APPLICATION_SRC}
64 )
65
66 # Include translation as a resource
67 # This works in the source directory to enable the rcc dependencies to be found
68 # and it also updates the currently available localization.
69 configure_file(l10n/l10n.qrc.in l10n.qrc)
70 qt5_add_resources(APPLICATION_SRC ${CMAKE_CURRENT_BINARY_DIR}/l10n.qrc)
71 qt5_create_translation(TRANSLATION_SRC ${FILES_TO_TRANSLATE}
72 ${CMAKE_CURRENT_SOURCE_DIR}/l10n/main_de_DE.ts)
73 endif()
74
75 add_executable(${PROJECT_NAME}
76 ${_add_executable_params}
77 # ${IMG_SRC}
78 ${APPLICATION_SRC}
79 ${TRANSLATION_SRC}
80 # ${CMAKE_SOURCE_DIR}/img/icon.rc
81 )
82
83
84 target_link_libraries(${PROJECT_NAME}
85 Qt5::Widgets
86 ${EXTRA_STATIC_LIBS})
87
88 if (WIN32)
89 set_target_properties(${PROJECT_NAME} PROPERTIES LINK_FLAGS "-municode")
90 endif(WIN32)
91
92 install(TARGETS ${PROJECT_NAME} DESTINATION bin)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)