diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2003-02-10 18:19:34 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2003-02-10 18:19:34 (GMT) |
commit | d94c0e0429e1bcb228b25a5c1370353d7b985d97 (patch) | |
tree | 79cdfea669938e4c8880babb1f9b7692ab441e93 /Tests/TryCompile | |
parent | c9cec2add5c9cd15ac3e90af3a09ec13cc208c92 (diff) | |
download | CMake-d94c0e0429e1bcb228b25a5c1370353d7b985d97.zip CMake-d94c0e0429e1bcb228b25a5c1370353d7b985d97.tar.gz CMake-d94c0e0429e1bcb228b25a5c1370353d7b985d97.tar.bz2 |
ENH: add a new test to test try compile
Diffstat (limited to 'Tests/TryCompile')
-rw-r--r-- | Tests/TryCompile/CMakeLists.txt | 53 | ||||
-rw-r--r-- | Tests/TryCompile/fail.c | 1 | ||||
-rw-r--r-- | Tests/TryCompile/pass.c | 6 |
3 files changed, 60 insertions, 0 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt new file mode 100644 index 0000000..cbb5595 --- /dev/null +++ b/Tests/TryCompile/CMakeLists.txt @@ -0,0 +1,53 @@ +PROJECT(TryCompileTest) + +# try to compile a file that should compile +TRY_COMPILE(SHOULD_PASS + ${TryCompileTest_BINARY_DIR}/CMakeTmp + ${TryCompileTest_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +IF(NOT SHOULD_PASS) + MESSAGE(SEND_ERROR "should pass failed ") +ENDIF(NOT SHOULD_PASS) +MESSAGE( "output from TRY_COMPILE ${TRY_OUT} ") + +# try to compile a file that should not compile +TRY_COMPILE(SHOULD_FAIL + ${TryCompileTest_BINARY_DIR}/CMakeTmp + ${TryCompileTest_SOURCE_DIR}/fail.c + OUTPUT_VARIABLE TRY_OUT) +IF(SHOULD_FAIL) + MESSAGE(SEND_ERROR "Should fail passed") +ENDIF(SHOULD_FAIL) +MESSAGE("output from TRY_COMPILE ${TRY_OUT} ") + +# try to compile a file that should compile +TRY_COMPILE(SHOULD_PASS + ${TryCompileTest_BINARY_DIR}/CMakeTmp + ${TryCompileTest_SOURCE_DIR}/pass.c + OUTPUT_VARIABLE TRY_OUT) +IF(NOT SHOULD_PASS) + MESSAGE(SEND_ERROR "should pass failed ") +ENDIF(NOT SHOULD_PASS) +MESSAGE("output from TRY_COMPILE ${TRY_OUT} ") + +# try to compile a file that should not compile +TRY_COMPILE(SHOULD_FAIL + ${TryCompileTest_BINARY_DIR}/CMakeTmp + ${TryCompileTest_SOURCE_DIR}/fail.c + OUTPUT_VARIABLE TRY_OUT) +IF(SHOULD_FAIL) + MESSAGE(SEND_ERROR "Should fail passed") +ENDIF(SHOULD_FAIL) +MESSAGE("output from TRY_COMPILE ${TRY_OUT} ") + +IF(NOT SHOULD_FAIL) + IF(SHOULD_PASS) + MESSAGE("All Tests passed, ignore all previous output.") + ELSE(SHOULD_PASS) + MESSAGE("Test failed") + ENDIF(SHOULD_PASS) +ELSE(NOT SHOULD_FAIL) + MESSAGE("Test failed") +ENDIF(NOT SHOULD_FAIL) + + diff --git a/Tests/TryCompile/fail.c b/Tests/TryCompile/fail.c new file mode 100644 index 0000000..b915ebe --- /dev/null +++ b/Tests/TryCompile/fail.c @@ -0,0 +1 @@ +asdflkjasdlj diff --git a/Tests/TryCompile/pass.c b/Tests/TryCompile/pass.c new file mode 100644 index 0000000..40bc5e2 --- /dev/null +++ b/Tests/TryCompile/pass.c @@ -0,0 +1,6 @@ +int main() +{ + return 0; +} + + |