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