diff options
author | Brad King <brad.king@kitware.com> | 2006-08-25 19:50:45 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2006-08-25 19:50:45 (GMT) |
commit | 3e572c936c90f7c3a56b3b1fcb98a2b445564f8b (patch) | |
tree | ef5cd3fa5eb2d0d9a160440cf65cc92049448113 /Source/kwsys/kwsysPlatformCxxTests.cmake | |
parent | 6849ae856b31950be630e453318d93a7d69f6bee (diff) | |
download | CMake-3e572c936c90f7c3a56b3b1fcb98a2b445564f8b.zip CMake-3e572c936c90f7c3a56b3b1fcb98a2b445564f8b.tar.gz CMake-3e572c936c90f7c3a56b3b1fcb98a2b445564f8b.tar.bz2 |
ENH: Added KWSYS_PLATFORM_CXX_TEST_RUN macro.
Diffstat (limited to 'Source/kwsys/kwsysPlatformCxxTests.cmake')
-rw-r--r-- | Source/kwsys/kwsysPlatformCxxTests.cmake | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/Source/kwsys/kwsysPlatformCxxTests.cmake b/Source/kwsys/kwsysPlatformCxxTests.cmake index 7775457..d08bfd0 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cmake +++ b/Source/kwsys/kwsysPlatformCxxTests.cmake @@ -43,3 +43,75 @@ MACRO(KWSYS_PLATFORM_CXX_TEST var description invert) ENDIF(${var}_COMPILED) ENDIF(${invert} MATCHES INVERT) ENDMACRO(KWSYS_PLATFORM_CXX_TEST) + +MACRO(KWSYS_PLATFORM_CXX_TEST_RUN var description invert) + IF("${var}" MATCHES "^${var}$") + MESSAGE(STATUS "${description}") + TRY_RUN(${var} ${var}_COMPILED + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx + COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_CXX_TEST_DEFINES} + OUTPUT_VARIABLE OUTPUT) + + # Note that ${var} will be a 0 return value on success. + IF(${var}_COMPILED) + IF(${var}) + FILE(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${description} compiled but failed to run with the following output:\n${OUTPUT}\n\n") + ELSE(${var}) + FILE(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log + "${description} compiled and ran with the following output:\n${OUTPUT}\n\n") + ENDIF(${var}) + ELSE(${var}_COMPILED) + FILE(APPEND + ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log + "${description} failed to compile with the following output:\n${OUTPUT}\n\n") + ENDIF(${var}_COMPILED) + + IF(${invert} MATCHES INVERT) + IF(${var}_COMPILED) + IF(${var}) + MESSAGE(STATUS "${description} - yes") + ELSE(${var}) + MESSAGE(STATUS "${description} - no") + ENDIF(${var}) + ELSE(${var}_COMPILED) + MESSAGE(STATUS "${description} - failed to compile") + ENDIF(${var}_COMPILED) + ELSE(${invert} MATCHES INVERT) + IF(${var}_COMPILED) + IF(${var}) + MESSAGE(STATUS "${description} - no") + ELSE(${var}) + MESSAGE(STATUS "${description} - yes") + ENDIF(${var}) + ELSE(${var}_COMPILED) + MESSAGE(STATUS "${description} - failed to compile") + ENDIF(${var}_COMPILED) + ENDIF(${invert} MATCHES INVERT) + ENDIF("${var}" MATCHES "^${var}$") + + IF(${invert} MATCHES INVERT) + IF(${var}_COMPILED) + IF(${var}) + SET(${var} 1) + ELSE(${var}) + SET(${var} 0) + ENDIF(${var}) + ELSE(${var}_COMPILED) + SET(${var} 1) + ENDIF(${var}_COMPILED) + ELSE(${invert} MATCHES INVERT) + IF(${var}_COMPILED) + IF(${var}) + SET(${var} 0) + ELSE(${var}) + SET(${var} 1) + ENDIF(${var}) + ELSE(${var}_COMPILED) + SET(${var} 0) + ENDIF(${var}_COMPILED) + ENDIF(${invert} MATCHES INVERT) +ENDMACRO(KWSYS_PLATFORM_CXX_TEST_RUN) |