comparison ui/CMakeLists.txt @ 33:25c08d63d2b7

Add CMakeLists in UI
author Andre Heinecke <andre.heinecke@intevation.de>
date Fri, 14 Mar 2014 08:57:51 +0100
parents
children 00aa5fa3c2fb
comparison
equal deleted inserted replaced
32:d8e93fa1fc93 33:25c08d63d2b7
1 find_package(Qt5Widgets REQUIRED)
2
3 include_directories(${Qt5Widgets_INCLUDE_DIRS})
4 add_definitions(${Qt5Widgets_DEFINITIONS})
5
6 set(CERTIFICATELIST_SOURCES
7 ${CMAKE_CURRENT_SOURCE_DIR}/certificatelist.cpp
8 ${CMAKE_CURRENT_SOURCE_DIR}/certificate.cpp
9 ${CMAKE_CURRENT_SOURCE_DIR}/certificate_win.cpp
10 ${CMAKE_CURRENT_SOURCE_DIR}/certificate_linux.cpp
11 ${CMAKE_SOURCE_DIR}/common/listutil.c
12 )
13
14 set(M13UI_SOURCES
15 ${CMAKE_CURRENT_SOURCE_DIR}/mainwindow.cpp
16 ${CMAKE_CURRENT_SOURCE_DIR}/downloader.cpp
17 ${CMAKE_CURRENT_SOURCE_DIR}/downloader_win.cpp
18 ${CMAKE_CURRENT_SOURCE_DIR}/downloader_linux.cpp
19 ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
20 ${CERTIFICATELIST_SOURCES}
21 )
22
23 # Seperated to make it easier to include the sources in tests
24 set(M13UI_RESOURCES
25 ${CMAKE_CURRENT_SOURCE_DIR}/icons.qrc
26 ${CMAKE_CURRENT_SOURCE_DIR}/certs.qrc
27 )
28
29 if(UNIX)
30 # See: https://bugreports.qt-project.org/browse/QTBUG-35918
31 # XCB_EXTRA_LIBS should be gotten automatically.
32 # The following list is taken from the .pri file
33 get_target_property(_loc Qt5::Widgets LOCATION)
34 get_filename_component(_qtpath ${_loc} PATH)
35 set(XCB_EXTRA_LIBS
36 -L${_qtpath}
37 -lX11 -lX11-xcb -lXi -lxcb-render-util -lXrender -lSM -lICE -lxcb-render -ldbus-1
38 -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr
39 -lxkbcommon -lxcb-shape -lxcb-keysyms -lQt5PlatformSupport
40 -lfreetype -lQt5DBus -lQt5Gui -ljpeg -lpng -lQt5Core
41 -lz -lm -ldl -lrt -lpthread)
42
43 set(EXTRA_STATIC_LIBS -lz -lpthread -ldl -lpng -ljpeg
44 Qt5::QXcbIntegrationPlugin ${XCB_EXTRA_LIBS})
45
46 elseif(WIN32)
47 get_target_property(_loc Qt5::Widgets LOCATION)
48 get_filename_component(_qtpath ${_loc} PATH)
49 set(WINDOWS_EXTRA_LIBS
50 -L${_qtpath}
51 -lwinspool -lshlwapi -lfreetype -lbz2 -lpng16
52 -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm
53 -lglu32 -lopengl32 -lgdi32 -ljpeg -lpng -lQt5Core -lole32 -luuid -lws2_32
54 -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lsicuin -lsicuuc -lsicudt -lpcre16)
55
56 set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS} -lwinhttp -lcrypt32)
57 endif()
58
59 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
60
61 add_custom_target(static_check)
62 generate_cppcheck(SOURCES ${CINST_SOURCES} ${M13UI_SOURCES} TARGET_NAME m13)
63 add_dependencies(static_check cppcheck)
64
65 # Adding resources here in an extra variable to enable reuse of
66 # M13UI_SOURCES in the test subdirectory.
67 set(M13UI_SOURCES_WITH_RESOURCES ${M13UI_SOURCES})
68 qt5_add_resources(M13UI_SOURCES_WITH_RESOURCES ${M13UI_RESOURCES})
69 add_executable(m13ui ${M13UI_SOURCES_WITH_RESOURCES})
70
71 target_link_libraries(m13ui Qt5::Widgets
72 ${EXTRA_STATIC_LIBS}
73 ${PROFILING_LIBS}
74 ${POLARSSL_LIBRARIES})
75
76 # Tests
77 add_subdirectory(tests)

http://wald.intevation.org/projects/trustbridge/