view CMakeLists.txt @ 30:53090844eddd

Fix check for windows in strhelp.h to work with strange mingw versions
author Andre Heinecke <andre.heinecke@intevation.de>
date Mon, 11 Apr 2016 13:36:59 +0200
parents e8320104979d
children aa47b8e4f807
line wrap: on
line source
# 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)
find_package(Qt5PrintSupport)

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 "-std=c++11 ${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)
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)