comparison CMakeLists.txt @ 0:147b08bc7d64

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