Mercurial > retraceit
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Mon Mar 23 12:41:52 2015 +0100 @@ -0,0 +1,64 @@ +# Copyright (C) 2014 by Intevation GmbH +# +# This file is Free Software under the GNU GPL (v>=2) +# and comes with ABSOLUTELY NO WARRANTY! +# See LICENSE.txt for details. + +cmake_minimum_required(VERSION 2.8.8) +project(replay-it) + + +### Generic Setup + +#Old qtmain linking behavior to be compatible with cmake versions < 2.8.11 + +if(POLICY CMP0020) + cmake_policy(SET CMP0020 OLD) +endif() + +set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") + +include(HGVersion) + +if(HG_REVISION) + If(HG_REVISION_DIST STREQUAL "0") + add_definitions(-DIS_TAG_BUILD) + endif() + set(PROJECT_VERSION ${HG_REVISION}) +else() + set(PROJECT_VERSION unknown) +endif() + +add_definitions(-DVERSION="${PROJECT_VERSION}") +add_definitions(-DAPPNAME="${PROJECT_NAME}") + +find_package(Qt5Widgets) + +set(CMAKE_AUTOMOC ON) +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +### Hardening flags + +set(HARDENING_FLAGS " -Wall -s -fstack-protector-all -fno-exceptions") +set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector") +set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4") +set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0") + +if(WIN32) + add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista + add_definitions(-DWINVER=0x0600) + add_definitions(-DUNICODE -D_UNICODE) + add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions +endif(WIN32) + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}") + +# Cmake does not correctly identify gcc windres when cross compiling +# making this line neccessary to set the correct flags for it. +# See: http://public.kitware.com/Bug/view.php?id=11773 +SET(CMAKE_RC_COMPILE_OBJECT + "<CMAKE_RC_COMPILER> <FLAGS> <DEFINES> -Ocoff <SOURCE> <OBJECT>") + +#add_subdirectory(img) +### Include the actual source directories +add_subdirectory(src)