diff options
author | Alexander Neundorf <neundorf@kde.org> | 2007-06-01 15:16:29 (GMT) |
---|---|---|
committer | Alexander Neundorf <neundorf@kde.org> | 2007-06-01 15:16:29 (GMT) |
commit | eddf1cf39f50f9b06131ead26b5b84b8edfd60da (patch) | |
tree | 1cbc429b0f2006f19ee9c19773f841648405793d /Modules/CheckCXXSourceRuns.cmake | |
parent | 26a5a295eb231dc9fae9ea90f6cf28d3b4eecaa2 (diff) | |
download | CMake-eddf1cf39f50f9b06131ead26b5b84b8edfd60da.zip CMake-eddf1cf39f50f9b06131ead26b5b84b8edfd60da.tar.gz CMake-eddf1cf39f50f9b06131ead26b5b84b8edfd60da.tar.bz2 |
ENH: improve TRY_RUN() for crosscompiling: instead of just failing, it now
creates two cache variables, one for the RUN_RESULT, one for the RUN_OUTPUT
(if required), which can be set or preset by the user. It has now also two
new arguments: RUN_OUTPUT_VARIABLE and COMPILE_OUTPUT_VARIABLE (the old
OUTPUT_VARIABLE merges both), so if only COMPILE_OUTPUT_VARIABLE is used the
run time output of the TRY_RUN is unused and the user doesn't have to care
about the output when crosscompiling. This is now used in FindThreads.cmake,
CheckC/CXXSourceRuns.cmake and TestBigEndian.cmake, which used the output
only for the logfile (compile output is still there). Test/TryCompile/ now
also tests the behaviour of OUTPUT_VARIABLE, RUN_OUTPUT_VARIABLE and
COMPILE_OUTPUT_VARIABLE.
Alex
Diffstat (limited to 'Modules/CheckCXXSourceRuns.cmake')
-rw-r--r-- | Modules/CheckCXXSourceRuns.cmake | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/Modules/CheckCXXSourceRuns.cmake b/Modules/CheckCXXSourceRuns.cmake index 04ae7a9..f117977 100644 --- a/Modules/CheckCXXSourceRuns.cmake +++ b/Modules/CheckCXXSourceRuns.cmake @@ -2,7 +2,7 @@ # CHECK_CXX_SOURCE_RUNS(SOURCE VAR) # - macro which checks if the source code compiles # SOURCE - source code to try to compile -# VAR - variable to store size if the type exists. +# VAR - variable to store the result, 1 for success, empty for failure # # The following variables may be set before calling this macro to # modify the way the check is run: @@ -39,7 +39,8 @@ MACRO(CHECK_CXX_SOURCE_RUNS SOURCE VAR) CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${MACRO_CHECK_FUNCTION_DEFINITIONS} "${CHECK_CXX_SOURCE_COMPILES_ADD_LIBRARIES}" "${CHECK_CXX_SOURCE_COMPILES_ADD_INCLUDES}" - OUTPUT_VARIABLE OUTPUT) + COMPILE_OUTPUT_VARIABLE OUTPUT) + # if it did not compile make the return value fail code of 1 IF(NOT ${VAR}_COMPILED) SET(${VAR} 1) |