ENH: add a new test for TRY_COMPILE

This commit is contained in:
Bill Hoffman 2003-02-10 16:20:10 -05:00
parent d94c0e0429
commit b04e32c642
2 changed files with 15 additions and 9 deletions

View File

@ -136,6 +136,11 @@ IF(BUILD_TESTING)
${CMake_BINARY_DIR}/Tests/SystemInformation ${CMake_BINARY_DIR}/Tests/SystemInformation
DumpInformation) DumpInformation)
ADD_TEST(TryCompile ${CMake_BINARY_DIR}/Source/cmaketest
${CMake_SOURCE_DIR}/Tests/TryCompile
${CMake_BINARY_DIR}/Tests/TryCompile
TryCompile)
ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest ADD_TEST(simple ${CMake_BINARY_DIR}/Source/cmaketest
${CMake_SOURCE_DIR}/Tests/Simple ${CMake_SOURCE_DIR}/Tests/Simple
${CMake_BINARY_DIR}/Tests/Simple ${CMake_BINARY_DIR}/Tests/Simple

View File

@ -1,9 +1,9 @@
PROJECT(TryCompileTest) PROJECT(TryCompile)
# try to compile a file that should compile # try to compile a file that should compile
TRY_COMPILE(SHOULD_PASS TRY_COMPILE(SHOULD_PASS
${TryCompileTest_BINARY_DIR}/CMakeTmp ${TryCompile_BINARY_DIR}/CMakeTmp
${TryCompileTest_SOURCE_DIR}/pass.c ${TryCompile_SOURCE_DIR}/pass.c
OUTPUT_VARIABLE TRY_OUT) OUTPUT_VARIABLE TRY_OUT)
IF(NOT SHOULD_PASS) IF(NOT SHOULD_PASS)
MESSAGE(SEND_ERROR "should pass failed ") MESSAGE(SEND_ERROR "should pass failed ")
@ -12,8 +12,8 @@ MESSAGE( "output from TRY_COMPILE ${TRY_OUT} ")
# try to compile a file that should not compile # try to compile a file that should not compile
TRY_COMPILE(SHOULD_FAIL TRY_COMPILE(SHOULD_FAIL
${TryCompileTest_BINARY_DIR}/CMakeTmp ${TryCompile_BINARY_DIR}/CMakeTmp
${TryCompileTest_SOURCE_DIR}/fail.c ${TryCompile_SOURCE_DIR}/fail.c
OUTPUT_VARIABLE TRY_OUT) OUTPUT_VARIABLE TRY_OUT)
IF(SHOULD_FAIL) IF(SHOULD_FAIL)
MESSAGE(SEND_ERROR "Should fail passed") MESSAGE(SEND_ERROR "Should fail passed")
@ -22,8 +22,8 @@ MESSAGE("output from TRY_COMPILE ${TRY_OUT} ")
# try to compile a file that should compile # try to compile a file that should compile
TRY_COMPILE(SHOULD_PASS TRY_COMPILE(SHOULD_PASS
${TryCompileTest_BINARY_DIR}/CMakeTmp ${TryCompile_BINARY_DIR}/CMakeTmp
${TryCompileTest_SOURCE_DIR}/pass.c ${TryCompile_SOURCE_DIR}/pass.c
OUTPUT_VARIABLE TRY_OUT) OUTPUT_VARIABLE TRY_OUT)
IF(NOT SHOULD_PASS) IF(NOT SHOULD_PASS)
MESSAGE(SEND_ERROR "should pass failed ") MESSAGE(SEND_ERROR "should pass failed ")
@ -32,8 +32,8 @@ MESSAGE("output from TRY_COMPILE ${TRY_OUT} ")
# try to compile a file that should not compile # try to compile a file that should not compile
TRY_COMPILE(SHOULD_FAIL TRY_COMPILE(SHOULD_FAIL
${TryCompileTest_BINARY_DIR}/CMakeTmp ${TryCompile_BINARY_DIR}/CMakeTmp
${TryCompileTest_SOURCE_DIR}/fail.c ${TryCompile_SOURCE_DIR}/fail.c
OUTPUT_VARIABLE TRY_OUT) OUTPUT_VARIABLE TRY_OUT)
IF(SHOULD_FAIL) IF(SHOULD_FAIL)
MESSAGE(SEND_ERROR "Should fail passed") MESSAGE(SEND_ERROR "Should fail passed")
@ -51,3 +51,4 @@ ELSE(NOT SHOULD_FAIL)
ENDIF(NOT SHOULD_FAIL) ENDIF(NOT SHOULD_FAIL)
ADD_EXECUTABLE(TryCompile pass.c)