summaryrefslogtreecommitdiffstats
path: root/Modules/CheckCXXSourceCompiles.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-10 00:23:18 (GMT)
committerBrad King <brad.king@kitware.com>2006-02-10 00:23:18 (GMT)
commitf0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155 (patch)
tree2cbfbb98abe5416da719d9960563efbd7419bc8f /Modules/CheckCXXSourceCompiles.cmake
parentf8a8e88a081600e8f6bbad8172f77fb4f422b5cd (diff)
downloadCMake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.zip
CMake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.tar.gz
CMake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.tar.bz2
ENH: Made Check* modules more consistent and well documented. Added CMAKE_REQUIRED_DEFINITIONS option.
Diffstat (limited to 'Modules/CheckCXXSourceCompiles.cmake')
-rw-r--r--Modules/CheckCXXSourceCompiles.cmake11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/CheckCXXSourceCompiles.cmake b/Modules/CheckCXXSourceCompiles.cmake
index 8f6e12b..2fcf38c 100644
--- a/Modules/CheckCXXSourceCompiles.cmake
+++ b/Modules/CheckCXXSourceCompiles.cmake
@@ -3,10 +3,14 @@
# - macro which checks if the source code compiles\
# SOURCE - source code to try to compile
# VAR - variable to store size if the type exists.
-# Checks the following optional VARIABLES (not arguments)
-# CMAKE_REQUIRED_LIBRARIES - Link to extra libraries
-# CMAKE_REQUIRED_FLAGS - Extra flags to C compiler
#
+# The following variables may be set before calling this macro to
+# modify the way the check is run:
+#
+# CMAKE_REQUIRED_FLAGS = string of compile command line flags
+# CMAKE_REQUIRED_DEFINITIONS = list of macros to define (-DFOO=bar)
+# CMAKE_REQUIRED_INCLUDES = list of include directories
+# CMAKE_REQUIRED_LIBRARIES = list of libraries to link
MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
IF("${VAR}" MATCHES "^${VAR}$")
@@ -31,6 +35,7 @@ MACRO(CHECK_CXX_SOURCE_COMPILES SOURCE VAR)
TRY_COMPILE(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.cxx
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
CMAKE_FLAGS
"${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}"