diff options
Diffstat (limited to 'Source/kwsys')
-rw-r--r-- | Source/kwsys/CMakeLists.txt | 2 | ||||
-rw-r--r-- | Source/kwsys/kwsysPlatformTests.cmake (renamed from Source/kwsys/kwsysPlatformCxxTests.cmake) | 53 | ||||
-rw-r--r-- | Source/kwsys/kwsysPlatformTestsC.c | 25 | ||||
-rw-r--r-- | Source/kwsys/kwsysPlatformTestsCXX.cxx (renamed from Source/kwsys/kwsysPlatformCxxTests.cxx) | 0 |
4 files changed, 70 insertions, 10 deletions
diff --git a/Source/kwsys/CMakeLists.txt b/Source/kwsys/CMakeLists.txt index 4e664b2..d85033c 100644 --- a/Source/kwsys/CMakeLists.txt +++ b/Source/kwsys/CMakeLists.txt @@ -145,7 +145,7 @@ IF(KWSYS_STANDALONE) ENDIF(KWSYS_STANDALONE) # Include helper macros. -INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cmake) +INCLUDE(${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformTests.cmake) INCLUDE(CheckTypeSize) # Do full dependency headers. diff --git a/Source/kwsys/kwsysPlatformCxxTests.cmake b/Source/kwsys/kwsysPlatformTests.cmake index 6560fa3..ddb151f 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cmake +++ b/Source/kwsys/kwsysPlatformTests.cmake @@ -1,17 +1,20 @@ -MACRO(KWSYS_PLATFORM_CXX_TEST var description invert) +SET(KWSYS_PLATFORM_TEST_FILE_C kwsysPlatformTestsC.cxx) +SET(KWSYS_PLATFORM_TEST_FILE_CXX kwsysPlatformTestsCXX.cxx) + +MACRO(KWSYS_PLATFORM_TEST lang var description invert) IF("${var}_COMPILED" MATCHES "^${var}_COMPILED$") MESSAGE(STATUS "${description}") TRY_COMPILE(${var}_COMPILED ${CMAKE_CURRENT_BINARY_DIR} - ${CMAKE_CURRENT_SOURCE_DIR}/kwsysPlatformCxxTests.cxx - COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_CXX_TEST_DEFINES} ${KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS} + ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}} + COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS} OUTPUT_VARIABLE OUTPUT) IF(${var}_COMPILED) - FILE(APPEND + FILE(APPEND ${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeOutput.log "${description} compiled with the following output:\n${OUTPUT}\n\n") ELSE(${var}_COMPILED) - FILE(APPEND + 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) @@ -42,15 +45,15 @@ MACRO(KWSYS_PLATFORM_CXX_TEST var description invert) SET(${var} 0) ENDIF(${var}_COMPILED) ENDIF(${invert} MATCHES INVERT) -ENDMACRO(KWSYS_PLATFORM_CXX_TEST) +ENDMACRO(KWSYS_PLATFORM_TEST) -MACRO(KWSYS_PLATFORM_CXX_TEST_RUN var description invert) +MACRO(KWSYS_PLATFORM_TEST_RUN lang 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} ${KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS} + ${CMAKE_CURRENT_SOURCE_DIR}/${KWSYS_PLATFORM_TEST_FILE_${lang}} + COMPILE_DEFINITIONS -DTEST_${var} ${KWSYS_PLATFORM_TEST_DEFINES} ${KWSYS_PLATFORM_TEST_EXTRA_FLAGS} OUTPUT_VARIABLE OUTPUT) # Note that ${var} will be a 0 return value on success. @@ -115,4 +118,36 @@ MACRO(KWSYS_PLATFORM_CXX_TEST_RUN var description invert) SET(${var} 0) ENDIF(${var}_COMPILED) ENDIF(${invert} MATCHES INVERT) +ENDMACRO(KWSYS_PLATFORM_TEST_RUN) + +MACRO(KWSYS_PLATFORM_C_TEST var description invert) + SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_C_TEST_DEFINES}) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_C_TEST_EXTRA_FLAGS}) + KWSYS_PLATFORM_TEST(C "${var}" "${description}" "${invert}") + SET(KWSYS_PLATFORM_TEST_DEFINES) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS) +ENDMACRO(KWSYS_PLATFORM_C_TEST) + +MACRO(KWSYS_PLATFORM_C_TEST_RUN var description invert) + SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_C_TEST_DEFINES}) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_C_TEST_EXTRA_FLAGS}) + KWSYS_PLATFORM_TEST_RUN(C "${var}" "${description}" "${invert}") + SET(KWSYS_PLATFORM_TEST_DEFINES) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS) +ENDMACRO(KWSYS_PLATFORM_C_TEST_RUN) + +MACRO(KWSYS_PLATFORM_CXX_TEST var description invert) + SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_CXX_TEST_DEFINES}) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS}) + KWSYS_PLATFORM_TEST(CXX "${var}" "${description}" "${invert}") + SET(KWSYS_PLATFORM_TEST_DEFINES) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS) +ENDMACRO(KWSYS_PLATFORM_CXX_TEST) + +MACRO(KWSYS_PLATFORM_CXX_TEST_RUN var description invert) + SET(KWSYS_PLATFORM_TEST_DEFINES ${KWSYS_PLATFORM_CXX_TEST_DEFINES}) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS ${KWSYS_PLATFORM_CXX_TEST_EXTRA_FLAGS}) + KWSYS_PLATFORM_TEST_RUN(CXX "${var}" "${description}" "${invert}") + SET(KWSYS_PLATFORM_TEST_DEFINES) + SET(KWSYS_PLATFORM_TEST_EXTRA_FLAGS) ENDMACRO(KWSYS_PLATFORM_CXX_TEST_RUN) diff --git a/Source/kwsys/kwsysPlatformTestsC.c b/Source/kwsys/kwsysPlatformTestsC.c new file mode 100644 index 0000000..36c5f4d --- /dev/null +++ b/Source/kwsys/kwsysPlatformTestsC.c @@ -0,0 +1,25 @@ +/* Macros to define main() in a cross-platform way. + Usage: + + int KWSYS_PLATFORM_TEST_C_MAIN() + { + return 0; + } + + int KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) + { + (void)argc; (void)argv; + return 0; + } +*/ +#if defined(__CLASSIC_C__) +# define KWSYS_PLATFORM_TEST_C_MAIN() \ + main() +# define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \ + main(argc,argv) int argc; char* argv[]; +#else +# define KWSYS_PLATFORM_TEST_C_MAIN() \ + main(void) +# define KWSYS_PLATFORM_TEST_C_MAIN_ARGS(argc, argv) \ + main(int argc, char* argv[]) +#endif diff --git a/Source/kwsys/kwsysPlatformCxxTests.cxx b/Source/kwsys/kwsysPlatformTestsCXX.cxx index ccc46fe..ccc46fe 100644 --- a/Source/kwsys/kwsysPlatformCxxTests.cxx +++ b/Source/kwsys/kwsysPlatformTestsCXX.cxx |