annotate CMakeLists.txt @ 648:e41a2537b84d

Implement root installation We now iterate over all users that do not obviously have their login shell disabled and look for NSS directories in their home directory, dropping our privileges to do so.
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 25 Jun 2014 12:44:47 +0200
parents 7dfa4555fb89
children a5a709c6ce93
rev   line source
405
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
1 # Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
2 # Software engineering by Intevation GmbH
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
3 #
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
4 # This file is Free Software under the GNU GPL (v>=2)
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
5 # and comes with ABSOLUTELY NO WARRANTY!
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
6 # See LICENSE.txt for details.
35d6b371ba63 Add License header for CMake and shell scripts
Andre Heinecke <aheinecke@intevation.de>
parents: 363
diff changeset
7
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
8 cmake_minimum_required(VERSION 2.8.8)
409
09bb19e5e369 Remove m13 mentions and change test certificate to intevation.de
Andre Heinecke <aheinecke@intevation.de>
parents: 405
diff changeset
9 project(trustbridge)
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
10
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
11 option(DO_RELEASE_BUILD "Build for a public release." OFF)
37
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
12 option(ENABLE_PROFILING "Set to enable profiling." OFF)
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
13
26
cbd57d767dfa Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
14 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
cbd57d767dfa Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
15
74
7ed285380301 Add cmake policy for adding qtmain on Windows
Andre Heinecke <aheinecke@intevation.de>
parents: 58
diff changeset
16 #Old qtmain linking behavior to be compatible with cmake versions < 2.8.11
106
37198bd07182 Check for policy CMP0020 before setting it
Andre Heinecke <aheinecke@intevation.de>
parents: 104
diff changeset
17
37198bd07182 Check for policy CMP0020 before setting it
Andre Heinecke <aheinecke@intevation.de>
parents: 104
diff changeset
18 if(POLICY CMP0020)
37198bd07182 Check for policy CMP0020 before setting it
Andre Heinecke <aheinecke@intevation.de>
parents: 104
diff changeset
19 cmake_policy(SET CMP0020 OLD)
37198bd07182 Check for policy CMP0020 before setting it
Andre Heinecke <aheinecke@intevation.de>
parents: 104
diff changeset
20 endif()
74
7ed285380301 Add cmake policy for adding qtmain on Windows
Andre Heinecke <aheinecke@intevation.de>
parents: 58
diff changeset
21
24
de67047ca229 Add documentation generation
Andre Heinecke <aheinecke@intevation.de>
parents: 22
diff changeset
22 include(CTest)
26
cbd57d767dfa Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
23 include(GenerateCppcheck)
495
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
24 include(HGVersion)
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
25
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
26 if(HG_REVISION)
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
27 set(PROJECT_VERSION ${HG_REVISION})
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
28 else()
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
29 set(PROJECT_VERSION unknown)
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
30 endif()
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
31
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
32 add_definitions(-DVERSION="${PROJECT_VERSION}")
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
33
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
34 find_package(PolarSSL)
104
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
35 include_directories(${POLARSSL_INCLUDE_DIR})
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
36
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
37 find_package(Qt5Widgets)
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
38
307
2fd69803d219 Complete InstRemove NSS test
Andre Heinecke <andre.heinecke@intevation.de>
parents: 171
diff changeset
39 find_package(NSS)
2fd69803d219 Complete InstRemove NSS test
Andre Heinecke <andre.heinecke@intevation.de>
parents: 171
diff changeset
40
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
41 # Use cmake's automoc and make sure the generated files are included
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
42 set(CMAKE_AUTOMOC ON)
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
43 set(CMAKE_INCLUDE_CURRENT_DIR ON)
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
44
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
45 if(DO_RELEASE_BUILD)
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
46 if (NOT CMAKE_BUILD_TYPE)
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
47 set (CMAKE_BUILD_TYPE RELEASE)
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
48 endif (NOT CMAKE_BUILD_TYPE)
171
04c1e0188ac3 Fixed RELEASE_BUILD define.
Sascha Wilde <wilde@intevation.de>
parents: 106
diff changeset
49 add_definitions (-DRELEASE_BUILD)
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
50 else()
7
992c0ec57660 Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents: 4
diff changeset
51 # Default to debug build
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
52 if (NOT CMAKE_BUILD_TYPE)
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
53 set (CMAKE_BUILD_TYPE Debug)
58
ad61489ce593 Set -g for debug builds
Andre Heinecke <aheinecke@intevation.de>
parents: 37
diff changeset
54 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
ad61489ce593 Set -g for debug builds
Andre Heinecke <aheinecke@intevation.de>
parents: 37
diff changeset
55 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -g")
34
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
56 endif (NOT CMAKE_BUILD_TYPE)
bee7d274c4dc Check for polarssl. Add release option to build with other certificates
Andre Heinecke <andre.heinecke@intevation.de>
parents: 26
diff changeset
57 endif()
7
992c0ec57660 Add unit tests make CertificateList work.
Andre Heinecke <aheinecke@intevation.de>
parents: 4
diff changeset
58
1
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
59 # Warn level to be used for privileged parts
13
e26f9cc93601 Also add Wall to GUI components. Link with crypto32 on windows
Andre Heinecke <aheinecke@intevation.de>
parents: 11
diff changeset
60 set(WARN_HARDENING_FLAGS " -Wextra -Wconversion -Wformat-security")
1
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
61
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
62 # Hardening flags
21
dc1e1e9e62ce Add certificate class and use it
Andre Heinecke <aheinecke@intevation.de>
parents: 18
diff changeset
63 set(HARDENING_FLAGS " -Wall -Werror -fstack-protector-all -fno-exceptions")
1
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
64 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector")
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
65 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4")
26
cbd57d767dfa Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
66 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0")
24
de67047ca229 Add documentation generation
Andre Heinecke <aheinecke@intevation.de>
parents: 22
diff changeset
67
37
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
68 if(ENABLE_PROFILING)
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
69 set(PROFILING_FLAGS "-fprofile-arcs -ftest-coverage")
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
70 set(PROFILING_LIBS gcov)
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
71 endif()
26
cbd57d767dfa Move layout around. Restructure CMakeLists
Andre Heinecke <andre.heinecke@intevation.de>
parents: 25
diff changeset
72
363
d10d9bc2e84f Update Windows api usage. Warning: To build on windows you need
Andre Heinecke <aheinecke@intevation.de>
parents: 307
diff changeset
73 if(WIN32)
d10d9bc2e84f Update Windows api usage. Warning: To build on windows you need
Andre Heinecke <aheinecke@intevation.de>
parents: 307
diff changeset
74 add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista
d10d9bc2e84f Update Windows api usage. Warning: To build on windows you need
Andre Heinecke <aheinecke@intevation.de>
parents: 307
diff changeset
75 add_definitions(-DWINVER=0x0600)
d10d9bc2e84f Update Windows api usage. Warning: To build on windows you need
Andre Heinecke <aheinecke@intevation.de>
parents: 307
diff changeset
76 add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions
d10d9bc2e84f Update Windows api usage. Warning: To build on windows you need
Andre Heinecke <aheinecke@intevation.de>
parents: 307
diff changeset
77 endif(WIN32)
d10d9bc2e84f Update Windows api usage. Warning: To build on windows you need
Andre Heinecke <aheinecke@intevation.de>
parents: 307
diff changeset
78
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
79 if(UNIX)
4
9849250f50f2 Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents: 1
diff changeset
80 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -pie -fPIE -ftrapv")
9849250f50f2 Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents: 1
diff changeset
81 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,-z,relro,-z,now")
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
82 elseif(WIN32)
4
9849250f50f2 Start implementation of certificatelist parser
Andre Heinecke <aheinecke@intevation.de>
parents: 1
diff changeset
83 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wl,--dynamicbase -Wl,--nxcompat")
0
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
84 endif()
cb0cde2c5eb9 Initial commit. Basically a Hello World with a Tray Icon.
Andre Heinecke <aheinecke@intevation.de>
parents:
diff changeset
85
75
ec0f4efefb7b Add profiling options for all C/CXX code if requested
Andre Heinecke <aheinecke@intevation.de>
parents: 74
diff changeset
86 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS} ${PROFILING_FLAGS}")
ec0f4efefb7b Add profiling options for all C/CXX code if requested
Andre Heinecke <aheinecke@intevation.de>
parents: 74
diff changeset
87 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARN_HARDENING_FLAGS} ${HARDENING_FLAGS} ${PROFILING_FLAGS}")
1
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
88
37
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
89 add_custom_target(static_check)
00aa5fa3c2fb Build System maintainance. Correct integration of Polarssl.
Andre Heinecke <aheinecke@intevation.de>
parents: 34
diff changeset
90
1
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
91 # FlawFinder
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
92 find_program(FLAWFINDER_PATH flawfinder DOC "flawfinder path")
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
93 if (FLAWFINDER_PATH)
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
94 add_custom_target(flawfinder COMMENT "FlawFinder" VERBATIM COMMAND ${FLAWFINDER_PATH}
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
95 ${CMAKE_SOURCE_DIR}/ui
18
f4f957c58e0a Move listuitol and add cert pinning with a test certificate
Andre Heinecke <aheinecke@intevation.de>
parents: 13
diff changeset
96 ${CMAKE_SOURCE_DIR}/cinst
25
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents: 24
diff changeset
97 ${CMAKE_SOURCE_DIR}/common
1
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
98 )
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
99 add_dependencies(static_check flawfinder)
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
100 endif (FLAWFINDER_PATH)
524cd4908656 Build infrastructure
Andre Heinecke <aheinecke@intevation.de>
parents: 0
diff changeset
101
618
7dfa4555fb89 Include common before ui to make common targets known
Andre Heinecke <andre.heinecke@intevation.de>
parents: 557
diff changeset
102 add_subdirectory(common)
7dfa4555fb89 Include common before ui to make common targets known
Andre Heinecke <andre.heinecke@intevation.de>
parents: 557
diff changeset
103
25
92108a2120f1 Move certificatelist to common. Add cinst directory
Andre Heinecke <aheinecke@intevation.de>
parents: 24
diff changeset
104 add_subdirectory(cinst)
104
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
105 if(Qt5Widgets_FOUND)
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
106 add_subdirectory(ui)
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
107 else()
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
108 message(STATUS "WARNING: Could not find qt. GUI parts will not be built.")
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
109 endif()
2a031ac963b0 Check for qt before including UI
Andre Heinecke <aheinecke@intevation.de>
parents: 75
diff changeset
110
24
de67047ca229 Add documentation generation
Andre Heinecke <aheinecke@intevation.de>
parents: 22
diff changeset
111 # Documentation
de67047ca229 Add documentation generation
Andre Heinecke <aheinecke@intevation.de>
parents: 22
diff changeset
112 configure_file (doc/Doxyfile.in doc/Doxyfile)
de67047ca229 Add documentation generation
Andre Heinecke <aheinecke@intevation.de>
parents: 22
diff changeset
113 add_subdirectory(doc)
495
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
114
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
115 # Configure packaging script for testing
500
4f972b1f4996 Fix packaging information generation
Andre Heinecke <aheinecke@intevation.de>
parents: 495
diff changeset
116 list(GET NSS_LIBRARIES 1 NSS_BASE_DIR)
4f972b1f4996 Fix packaging information generation
Andre Heinecke <aheinecke@intevation.de>
parents: 495
diff changeset
117 get_filename_component(NSS_BASE_DIR ${NSS_BASE_DIR} PATH)
4f972b1f4996 Fix packaging information generation
Andre Heinecke <aheinecke@intevation.de>
parents: 495
diff changeset
118
4f972b1f4996 Fix packaging information generation
Andre Heinecke <aheinecke@intevation.de>
parents: 495
diff changeset
119 set(NSS_BASE_DIR "${NSS_BASE_DIR}/..")
495
7a8f5b85fd9a Dynamically generate version information from HG
Andre Heinecke <aheinecke@intevation.de>
parents: 409
diff changeset
120 configure_file (packaging/tmp-createpackage.sh.in packaging/tmp-createpackage.sh)
557
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
121
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
122 if (ENABLE_PROFILING)
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
123 configure_file (make-coverage.sh.in make-coverage.sh)
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
124 add_custom_target(lcov COMMENT "Lcov coverage report" VERBATIM COMMAND /bin/bash
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
125 ${CMAKE_CURRENT_BINARY_DIR}/make-coverage.sh
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
126 )
5cd525fc91de Add lcov target to generate coverage report
Andre Heinecke <aheinecke@intevation.de>
parents: 500
diff changeset
127 endif()

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