aboutsummaryrefslogtreecommitdiff
path: root/kde-modules/KDECompilerSettings.cmake
diff options
context:
space:
mode:
authorAlex Merry <kde@randomguy3.me.uk>2014-01-24 14:28:49 +0000
committerAlex Merry <kde@randomguy3.me.uk>2014-01-27 12:03:02 +0000
commit5067d2151e6e2924e15daae6ad769df7b02dff49 (patch)
tree14a18ed644bcddf3763d9a28cc6069718a2ec6c7 /kde-modules/KDECompilerSettings.cmake
parent0bada507e4e209f2abc360c5ff22aad805a41ee1 (diff)
downloadextra-cmake-modules-5067d2151e6e2924e15daae6ad769df7b02dff49.tar.gz
extra-cmake-modules-5067d2151e6e2924e15daae6ad769df7b02dff49.tar.bz2
Add system API feature macros to CMAKE_REQUIRED_DEFINES
Various defines we set affect the API offered by the system; subsequent CMake configure checks should happen in a matching environment. REVIEW: 115294
Diffstat (limited to 'kde-modules/KDECompilerSettings.cmake')
-rw-r--r--kde-modules/KDECompilerSettings.cmake18
1 files changed, 13 insertions, 5 deletions
diff --git a/kde-modules/KDECompilerSettings.cmake b/kde-modules/KDECompilerSettings.cmake
index 78911361..ffbb5c5f 100644
--- a/kde-modules/KDECompilerSettings.cmake
+++ b/kde-modules/KDECompilerSettings.cmake
@@ -11,6 +11,14 @@
include(CheckCXXCompilerFlag)
+# This macro is for adding definitions that affect the underlying
+# platform API. It makes sure that configure checks will also have
+# the same defines, so that the checks match compiled code.
+macro (_KDE_ADD_PLATFORM_DEFINITIONS)
+ add_definitions(${ARGV})
+ set(CMAKE_REQUIRED_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS} ${ARGV})
+endmacro()
+
if (WIN32)
# windows, microsoft compiler
@@ -20,7 +28,7 @@ if (WIN32)
add_definitions(-DKDE_FULL_TEMPLATE_EXPORT_INSTANTIATION)
# Speeds up compile times by not including everything with windows.h
- add_definitions(-DWIN32_LEAN_AND_MEAN)
+ _kde_add_platform_definitions(-DWIN32_LEAN_AND_MEAN)
# Disable warnings:
# C4250: 'class1' : inherits 'class2::member' via dominance
@@ -62,9 +70,9 @@ if (WIN32)
set(CMAKE_DEBUG_POSTFIX "")
# we don't support anything below w2k
- add_definitions(-D_WIN32_WINNT=0x0501 -DWINVER=0x0501 -D_WIN32_IE=0x0501)
+ _kde_add_platform_definitions(-D_WIN32_WINNT=0x0501 -DWINVER=0x0501 -D_WIN32_IE=0x0501)
# all winapi calls are unicodes
- add_definitions(-DUNICODE)
+ _kde_add_platform_definitions(-DUNICODE)
endif (WIN32)
@@ -84,13 +92,13 @@ if ("${CMAKE_SYSTEM_NAME}" MATCHES Linux OR "${CMAKE_SYSTEM_NAME}" STREQUAL GNU)
# _BSD_SOURCE: is/was needed by glibc for snprintf to be available when
# building C files.
# See commit 4a44862b2d178c1d2e1eb4da90010d19a1e4a42c.
- add_definitions(-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE)
+ _kde_add_platform_definitions(-D_XOPEN_SOURCE=500 -D_BSD_SOURCE -D_GNU_SOURCE)
endif()
if (UNIX)
# 64-bit file offsets
- add_definitions(-D_LARGEFILE64_SOURCE)
+ _kde_add_platform_definitions(-D_LARGEFILE64_SOURCE)
endif (UNIX)