Mercurial > clickerconvert
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/CMakeLists.txt Mon Mar 07 17:35:09 2016 +0100 @@ -0,0 +1,70 @@ +# Copyright (C) 2016 by ETH Zürich +# Software engineering 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(clickerconvert) + + +### 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 + +if(NOT APPLE) + 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") +endif(NOT APPLE) + +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) + +configure_file (doc/Doxyfile.in doc/Doxyfile) +add_subdirectory(doc)