annotate CMakeLists.txt @ 0:49cd5cc0b072

Initial commit of project template (based on RetraceIT)
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 07 Mar 2016 17:35:09 +0100
parents
children e8320104979d
rev   line source
0
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
1 # Copyright (C) 2016 by ETH Zürich
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
2 # Software engineering by Intevation GmbH
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
3 #
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
4 # This file is Free Software under the GNU GPL (v>=2)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
5 # and comes with ABSOLUTELY NO WARRANTY!
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
6 # See LICENSE.txt for details.
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
7
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
8 cmake_minimum_required(VERSION 2.8.8)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
9 project(clickerconvert)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
10
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
11
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
12 ### Generic Setup
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
13
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
14 #Old qtmain linking behavior to be compatible with cmake versions < 2.8.11
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
15
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
16 if(POLICY CMP0020)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
17 cmake_policy(SET CMP0020 OLD)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
18 endif()
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
19
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
20 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
21
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
22 include(HGVersion)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
23
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
24 if(HG_REVISION)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
25 If(HG_REVISION_DIST STREQUAL "0")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
26 add_definitions(-DIS_TAG_BUILD)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
27 endif()
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
28 set(PROJECT_VERSION ${HG_REVISION})
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
29 else()
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
30 set(PROJECT_VERSION unknown)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
31 endif()
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
32
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
33 add_definitions(-DVERSION="${PROJECT_VERSION}")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
34 add_definitions(-DAPPNAME="${PROJECT_NAME}")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
35
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
36 find_package(Qt5Widgets)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
37
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38 set(CMAKE_AUTOMOC ON)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 set(CMAKE_INCLUDE_CURRENT_DIR ON)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41 ### Hardening flags
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43 if(NOT APPLE)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 set(HARDENING_FLAGS " -Wall -s -fstack-protector-all -fno-exceptions")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
46 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
47 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
48 endif(NOT APPLE)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
49
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50 if(WIN32)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51 add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 add_definitions(-DWINVER=0x0600)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
53 add_definitions(-DUNICODE -D_UNICODE)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
54 add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55 endif(WIN32)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
56
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
57 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
58
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
59 # Cmake does not correctly identify gcc windres when cross compiling
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
60 # making this line neccessary to set the correct flags for it.
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
61 # See: http://public.kitware.com/Bug/view.php?id=11773
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
62 SET(CMAKE_RC_COMPILE_OBJECT
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
63 "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -Ocoff <SOURCE> <OBJECT>")
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
64
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
65 #add_subdirectory(img)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66 ### Include the actual source directories
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 add_subdirectory(src)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
68
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
69 configure_file (doc/Doxyfile.in doc/Doxyfile)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
70 add_subdirectory(doc)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)