andre@25: # Copyright (C) 2015 by ETH Zürich andre@27: # Software engineering by Intevation GmbH andre@0: # andre@0: # This file is Free Software under the GNU GPL (v>=2) andre@0: # and comes with ABSOLUTELY NO WARRANTY! andre@0: # See LICENSE.txt for details. andre@0: andre@0: cmake_minimum_required(VERSION 2.8.8) andre@37: project(retraceit) andre@0: andre@0: andre@0: ### Generic Setup andre@0: andre@0: #Old qtmain linking behavior to be compatible with cmake versions < 2.8.11 andre@0: andre@0: if(POLICY CMP0020) andre@0: cmake_policy(SET CMP0020 OLD) andre@0: endif() andre@0: andre@0: set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/") andre@0: andre@0: include(HGVersion) andre@0: andre@0: if(HG_REVISION) andre@0: If(HG_REVISION_DIST STREQUAL "0") andre@0: add_definitions(-DIS_TAG_BUILD) andre@0: endif() andre@0: set(PROJECT_VERSION ${HG_REVISION}) andre@0: else() andre@0: set(PROJECT_VERSION unknown) andre@0: endif() andre@0: andre@0: add_definitions(-DVERSION="${PROJECT_VERSION}") andre@0: add_definitions(-DAPPNAME="${PROJECT_NAME}") andre@0: andre@0: find_package(Qt5Widgets) andre@0: andre@0: set(CMAKE_AUTOMOC ON) andre@0: set(CMAKE_INCLUDE_CURRENT_DIR ON) andre@0: andre@0: ### Hardening flags andre@0: andre@57: if(NOT APPLE) andre@57: set(HARDENING_FLAGS " -Wall -s -fstack-protector-all -fno-exceptions") andre@57: set(HARDENING_FLAGS " ${HARDENING_FLAGS} -Wstack-protector") andre@57: set(HARDENING_FLAGS " ${HARDENING_FLAGS} --param ssp-buffer-size=4") andre@57: set(HARDENING_FLAGS " ${HARDENING_FLAGS} -D_FORTIFY_SOURCE=2 -O0") andre@57: endif(NOT APPLE) andre@0: andre@0: if(WIN32) andre@0: add_definitions(-D_WIN32_WINNT=0x0600) # Windows vista andre@0: add_definitions(-DWINVER=0x0600) andre@0: add_definitions(-DUNICODE -D_UNICODE) andre@0: add_definitions(-DMINGW_HAS_SECURE_API) # for _s functions andre@0: endif(WIN32) andre@0: andre@0: set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${HARDENING_FLAGS}") andre@0: andre@0: # Cmake does not correctly identify gcc windres when cross compiling andre@0: # making this line neccessary to set the correct flags for it. andre@0: # See: http://public.kitware.com/Bug/view.php?id=11773 andre@0: SET(CMAKE_RC_COMPILE_OBJECT andre@0: " -Ocoff ") andre@0: andre@0: #add_subdirectory(img) andre@0: ### Include the actual source directories andre@0: add_subdirectory(src)