diff options
author | Brad King <brad.king@kitware.com> | 2006-02-10 00:23:18 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-02-10 00:23:18 (GMT) |
commit | f0a1da00c1d46bd3ffd0e1f4cfd76a3bbf2a2155 (patch) | |
tree | 2cbfbb98abe5416da719d9960563efbd7419bc8f /Modules/CheckCSourceCompiles.cmake | |
parent | f8a8e88a081600e8f6bbad8172f77fb4f422b5cd (diff) | |
download | CMake-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/CheckCSourceCompiles.cmake')
-rw-r--r-- | Modules/CheckCSourceCompiles.cmake | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Modules/CheckCSourceCompiles.cmake b/Modules/CheckCSourceCompiles.cmake index 35b3d7e..b08ea0a 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}" |