diff CMakeLists.txt @ 26:cbd57d767dfa

Move layout around. Restructure CMakeLists
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 11 Mar 2014 19:00:35 +0100
parents 92108a2120f1
children bee7d274c4dc
line wrap: on
line diff
--- a/CMakeLists.txt	Mon Mar 10 14:15:15 2014 +0000
+++ b/CMakeLists.txt	Tue Mar 11 19:00:35 2014 +0100
@@ -1,9 +1,10 @@
 cmake_minimum_required(VERSION 2.8.8)
 project(m13)
 
+set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
+
 include(CTest)
-
-set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
+include(GenerateCppcheck)
 
 # Use cmake's automoc and make sure the generated files are included
 set(CMAKE_AUTOMOC ON)
@@ -14,34 +15,6 @@
   set (CMAKE_BUILD_TYPE Debug)
 endif (NOT CMAKE_BUILD_TYPE)
 
-find_package(Qt5Widgets REQUIRED)
-
-include_directories(${Qt5Widgets_INCLUDE_DIRS})
-add_definitions(${Qt5Widgets_DEFINITIONS})
-
-set(CERTIFICATELIST_SOURCES
-    ${CMAKE_SOURCE_DIR}/ui/certificatelist.cpp
-    ${CMAKE_SOURCE_DIR}/ui/certificate.cpp
-    ${CMAKE_SOURCE_DIR}/ui/certificate_win.cpp
-    ${CMAKE_SOURCE_DIR}/ui/certificate_linux.cpp
-    ${CMAKE_SOURCE_DIR}/common/listutil.c
-)
-
-set(M13UI_SOURCES
-    ${CMAKE_SOURCE_DIR}/ui/mainwindow.cpp
-    ${CMAKE_SOURCE_DIR}/ui/downloader.cpp
-    ${CMAKE_SOURCE_DIR}/ui/downloader_win.cpp
-    ${CMAKE_SOURCE_DIR}/ui/downloader_linux.cpp
-    ${CMAKE_SOURCE_DIR}/ui/main.cpp
-    ${CERTIFICATELIST_SOURCES}
-)
-
-# Seperated to make it easier to include the sources in tests
-set(M13UI_RESOURCES
-   ${CMAKE_SOURCE_DIR}/ui/icons.qrc
-   ${CMAKE_SOURCE_DIR}/ui/certs.qrc
-)
-
 # Warn level to be used for privileged parts
 set(WARN_HARDENING_FLAGS " -Wextra -Wconversion -Wformat-security")
 
@@ -49,63 +22,23 @@
 set(HARDENING_FLAGS " -Wall -Werror -fstack-protector-all -fno-exceptions")
 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector")
 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4")
-set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0 -fprofile-arcs -ftest-coverage")
+set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0")
 
-SET(CMAKE_EXE_LINKER_FLAGS="-fprofile-arcs -ftest-coverage")
+# Uncomment to enable profiling
+# set(PROFILING_FLAGS "-fprofile-arcs -ftest-coverage")
+
+SET(CMAKE_EXE_LINKER_FLAGS=${PROFILING_FLAGS})
 
 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 -static -static-libgcc
-      -L${_qtpath}
-      -lX11 -lX11-xcb -lXi -lxcb-render-util -lXrender -lSM -lICE -lxcb-render -ldbus-1
-      -lxcb -lxcb-image -lxcb-icccm -lxcb-sync -lxcb-xfixes -lxcb-shm -lxcb-randr
-      -lxcb-shape -lxcb-keysyms -lQt5PlatformSupport
-      -lfreetype -lQt5DBus -lQt5Gui -ljpeg -lpng -lQt5Core
-      -lz -lm -ldl -lrt -lpthread)
-
-   set(EXTRA_STATIC_LIBS -lz -lpthread -ldl -lpng -ljpeg
-      Qt5::QXcbIntegrationPlugin ${XCB_EXTRA_LIBS})
-
    set(HARDENING_FLAGS " ${HARDENING_FLAGS} -pie -fPIE -ftrapv")
    set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,-z,relro,-z,now")
 elseif(WIN32)
-   get_target_property(_loc Qt5::Widgets LOCATION)
-   get_filename_component(_qtpath ${_loc} PATH)
-   set(WINDOWS_EXTRA_LIBS
-        -L${_qtpath}
-        -lwinspool -lshlwapi -lfreetype -lbz2 -lpng16
-        -lQt5PlatformSupport -lQt5Gui -lcomdlg32 -loleaut32 -limm32 -lwinmm
-        -lglu32 -lopengl32 -lgdi32 -ljpeg -lpng -lQt5Core -lole32 -luuid -lws2_32
-        -ladvapi32 -lshell32 -luser32 -lkernel32 -lz -lsicuin -lsicuuc -lsicudt -lpcre16)
-
-   set(EXTRA_STATIC_LIBS Qt5::QWindowsIntegrationPlugin ${WINDOWS_EXTRA_LIBS} -lwinhttp -lcrypt32)
-
    set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat")
 endif()
 
-set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${Qt5Widgets_EXECUTABLE_COMPILE_FLAGS}")
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}")
 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_HARDENING_FLAGS} ${HARDENING_FLAGS}")
 
-# Adding resources here in an extra variable to enable reuse of
-# M13UI_SOURCES in the test subdirectory.
-set(M13UI_SOURCES_WITH_RESOURCES ${M13UI_SOURCES})
-qt5_add_resources(M13UI_SOURCES_WITH_RESOURCES ${M13UI_RESOURCES})
-add_executable(m13ui ${M13UI_SOURCES_WITH_RESOURCES})
-
-target_link_libraries(m13ui Qt5::Widgets ${EXTRA_STATIC_LIBS} gcov)
-
-add_custom_target(static_check)
-
-# CPPCheck
-include(GenerateCppcheck)
-generate_cppcheck(SOURCES ${CINST_SOURCES} ${M13UI_SOURCES} TARGET_NAME m13)
-add_dependencies(static_check cppcheck)
-
 # FlawFinder
 find_program(FLAWFINDER_PATH flawfinder DOC "flawfinder path")
 if (FLAWFINDER_PATH)
@@ -117,9 +50,8 @@
     add_dependencies(static_check flawfinder)
 endif (FLAWFINDER_PATH)
 
-# Tests
-add_subdirectory(tests)
 add_subdirectory(cinst)
+add_subdirectory(ui)
 
 # Documentation
 configure_file (doc/Doxyfile.in doc/Doxyfile)

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