annotate CMakeLists.txt @ 51:e9cc707838d1

Add Windows packaging
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 19 Jul 2016 17:44:17 +0200
parents aa47b8e4f807
children a43d8cf2fa95
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)
44
aa47b8e4f807 Rename to EduExportConvert
Andre Heinecke <andre.heinecke@intevation.de>
parents: 22
diff changeset
9 project(eduexportconvert)
0
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)
22
e8320104979d Depend on Printsupport use c++11
Andre Heinecke <andre.heinecke@intevation.de>
parents: 0
diff changeset
37 find_package(Qt5PrintSupport)
0
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
38
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
39 set(CMAKE_AUTOMOC ON)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
40 set(CMAKE_INCLUDE_CURRENT_DIR ON)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
41
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
42 ### Hardening flags
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
43
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
44 if(NOT APPLE)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
45 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
46 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
47 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
48 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
49 endif(NOT APPLE)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
50
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
51 if(WIN32)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
52 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
53 add_definitions(-DWINVER=0x0600)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
54 add_definitions(-DUNICODE -D_UNICODE)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
55 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
56 endif(WIN32)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
57
22
e8320104979d Depend on Printsupport use c++11
Andre Heinecke <andre.heinecke@intevation.de>
parents: 0
diff changeset
58 set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}")
0
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
59
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
60 # 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
61 # 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
62 # 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
63 SET(CMAKE_RC_COMPILE_OBJECT
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
64 "<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
65
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
66 #add_subdirectory(img)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
67 ### Include the actual source directories
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
68 add_subdirectory(src)
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
69
49cd5cc0b072 Initial commit of project template (based on RetraceIT)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff changeset
70 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
71 add_subdirectory(doc)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)