Mercurial > retraceit
annotate CMakeLists.txt @ 113:20ec21924338 tip
Added tag 1.4 for changeset 9daf778feaf1
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Thu, 08 Dec 2016 15:34:30 +0100 |
parents | 32dd6ea6a582 |
children |
rev | line source |
---|---|
25
64a51a42c01f
Assign copyright correctly
Andre Heinecke <andre.heinecke@intevation.de>
parents:
0
diff
changeset
|
1 # Copyright (C) 2015 by ETH Zürich |
27
5bd14af5bce5
Fix copyright header in CMake files (wrong comment character)
Andre Heinecke <andre.heinecke@intevation.de>
parents:
25
diff
changeset
|
2 # Software engineering by Intevation GmbH |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
3 # |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
4 # This file is Free Software under the GNU GPL (v>=2) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
5 # and comes with ABSOLUTELY NO WARRANTY! |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
6 # See LICENSE.txt for details. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
7 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
8 cmake_minimum_required(VERSION 2.8.8) |
37
0c05958d254c
(issue 13, 6) Add constant index number column to data and view
Andre Heinecke <andre.heinecke@intevation.de>
parents:
30
diff
changeset
|
9 project(retraceit) |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
10 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
11 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
12 ### Generic Setup |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
13 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
14 #Old qtmain linking behavior to be compatible with cmake versions < 2.8.11 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
15 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
16 if(POLICY CMP0020) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
17 cmake_policy(SET CMP0020 OLD) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
18 endif() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
19 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
20 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
21 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
22 include(HGVersion) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
23 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
24 if(HG_REVISION) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
25 If(HG_REVISION_DIST STREQUAL "0") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
26 add_definitions(-DIS_TAG_BUILD) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
27 endif() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
28 set(PROJECT_VERSION ${HG_REVISION}) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
29 else() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
30 set(PROJECT_VERSION unknown) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
31 endif() |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
32 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
33 add_definitions(-DVERSION="${PROJECT_VERSION}") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
34 add_definitions(-DAPPNAME="${PROJECT_NAME}") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
35 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
36 find_package(Qt5Widgets) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
37 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
38 set(CMAKE_AUTOMOC ON) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
39 set(CMAKE_INCLUDE_CURRENT_DIR ON) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
40 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
41 ### Hardening flags |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
42 |
57
2cd76e6c0fcf
Add MacOS build support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
37
diff
changeset
|
43 if(NOT APPLE) |
2cd76e6c0fcf
Add MacOS build support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
37
diff
changeset
|
44 set(HARDENING_FLAGS " -Wall -s -fstack-protector-all -fno-exceptions") |
2cd76e6c0fcf
Add MacOS build support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
37
diff
changeset
|
45 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector") |
2cd76e6c0fcf
Add MacOS build support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
37
diff
changeset
|
46 set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4") |
2cd76e6c0fcf
Add MacOS build support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
37
diff
changeset
|
47 set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0") |
2cd76e6c0fcf
Add MacOS build support
Andre Heinecke <andre.heinecke@intevation.de>
parents:
37
diff
changeset
|
48 endif(NOT APPLE) |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
49 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
50 if(WIN32) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
51 add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
52 add_definitions(-DWINVER=0x0600) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
53 add_definitions(-DUNICODE -D_UNICODE) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
54 add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
55 endif(WIN32) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
56 |
106
32dd6ea6a582
Explicitly use c++11 as newer qt versions need that.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
66
diff
changeset
|
57 set(CMAKE_CXX_FLAGS "-std=c++11 ${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}") |
0
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
58 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
59 # Cmake does not correctly identify gcc windres when cross compiling |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
60 # making this line neccessary to set the correct flags for it. |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
61 # See: http://public.kitware.com/Bug/view.php?id=11773 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
62 SET(CMAKE_RC_COMPILE_OBJECT |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
63 "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -Ocoff <SOURCE> <OBJECT>") |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
64 |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
65 #add_subdirectory(img) |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
66 ### Include the actual source directories |
147b08bc7d64
Initial commit of a basic Application framework.
Andre Heinecke <andre.heinecke@intevation.de>
parents:
diff
changeset
|
67 add_subdirectory(src) |
66
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
57
diff
changeset
|
68 |
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
57
diff
changeset
|
69 configure_file (doc/Doxyfile.in doc/Doxyfile) |
098a10fc2e83
Add doxygen files and improve doxygen comments
Andre Heinecke <andre.heinecke@intevation.de>
parents:
57
diff
changeset
|
70 add_subdirectory(doc) |