view CMakeLists.txt @ 57:2cd76e6c0fcf

Add MacOS build support
author Andre Heinecke <andre.heinecke@intevation.de>
date Tue, 19 May 2015 15:36:00 +0200
parents 0c05958d254c
children 098a10fc2e83
line wrap: on
line source
# Copyright (C) 2015 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(retraceit)


### 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)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)