summaryrefslogtreecommitdiff
path: root/Modules/CheckCSourceCompiles.cmake
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2006-02-09 19:23:18 -0500
committerBrad King <brad.king@kitware.com>2006-02-09 19:23:18 -0500
commitf0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155 (patch)
tree2cbfbb98abe5416da719d9960563efbd7419bc8f /Modules/CheckCSourceCompiles.cmake
parentf8a8e88a081600e8f6bbad8172f77fb4f422b5cd (diff)
downloadcmake-f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155.tar.gz
ENH: Made Check* modules more consistent and well documented. Added CMAKE_REQUIRED_DEFINITIONS option.
Diffstat (limited to 'Modules/CheckCSourceCompiles.cmake')
-rw-r--r--Modules/CheckCSourceCompiles.cmake11
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake
index 35b3d7e1a7..b08ea0a3a4 100644
--- a/Modules/CheckCSourceCompiles.cmake
+++ b/Modules/CheckCSourceCompiles.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_C_SOURCE_COMPILES SOURCE VAR)
IF("${VAR}" MATCHES "^${VAR}$")
@@ -31,6 +35,7 @@ MACRO(CHECK_C_SOURCE_COMPILES SOURCE VAR)
TRY_COMPILE(${VAR}
${CMAKE_BINARY_DIR}
${CMAKE_BINARY_DIR}/CMakeFiles/CMakeTmp/src.c
+ COMPILE_DEFINITIONS ${CMAKE_REQUIRED_DEFINITIONS}
CMAKE_FLAGS
"${CHECK_C_SOURCE_COMPILES_ADD_LIBRARIES}"
"${CHECK_C_SOURCE_COMPILES_ADD_INCLUDES}"