summaryrefslogtreecommitdiffstats
path: root/Tests/TryCompile/CMakeLists.txt
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2013-07-15 13:33:32 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2013-07-15 13:33:32 (GMT)
commitf6024ef420103c4cb393d7752f7e110c5e0d5dfe (patch)
treee7c12ecc29f108e275e7212ccf7c267069d2662e /Tests/TryCompile/CMakeLists.txt
parentc0fe24e53969450273eb08aa6e6b615563847c9b (diff)
parentc28715b16c7a71cd8ea0416277cc87ee9bc8eaa1 (diff)
downloadCMake-f6024ef420103c4cb393d7752f7e110c5e0d5dfe.zip
CMake-f6024ef420103c4cb393d7752f7e110c5e0d5dfe.tar.gz
CMake-f6024ef420103c4cb393d7752f7e110c5e0d5dfe.tar.bz2
Merge topic 'try_compile-COPY_FILE_ERROR'
c28715b try_compile: Add COPY_FILE_ERROR option to capture failure
Diffstat (limited to 'Tests/TryCompile/CMakeLists.txt')
-rw-r--r--Tests/TryCompile/CMakeLists.txt17
1 files changed, 17 insertions, 0 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 7b25e84..a4d9490 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -44,6 +44,23 @@ else()
file(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass")
endif()
+# try to compile a file that should compile
+# also check that COPY_FILE_ERROR works
+file(WRITE ${TryCompile_BINARY_DIR}/invalid "")
+try_compile(SHOULD_PASS
+ ${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
+ ${TryCompile_SOURCE_DIR}/pass.c
+ OUTPUT_VARIABLE TRY_OUT
+ COPY_FILE ${TryCompile_BINARY_DIR}/invalid/path
+ COPY_FILE_ERROR _captured
+ )
+if(NOT SHOULD_PASS)
+ message(SEND_ERROR "should pass failed ${TRY_OUT}")
+endif()
+if(NOT _captured MATCHES "Cannot copy output executable.*/invalid/path")
+ message(SEND_ERROR "COPY_FILE_ERROR did not capture expected message")
+endif()
+
# try to compile a file that should not compile
try_compile(SHOULD_FAIL
${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp