summaryrefslogtreecommitdiffstats
path: root/Tests/TryCompile/CMakeLists.txt
diff options
context:
space:
mode:
authorAlexander Neundorf <neundorf@kde.org>2007-05-24 16:06:59 (GMT)
committerAlexander Neundorf <neundorf@kde.org>2007-05-24 16:06:59 (GMT)
commit7147c3e1cc23953abc968e9502669ef7628de75c (patch)
tree77623c4e22a14c85452c3e0a9b8c3807795d0d32 /Tests/TryCompile/CMakeLists.txt
parent7d7aba292c09170fc9f145d68644e1ff6d158eec (diff)
downloadCMake-7147c3e1cc23953abc968e9502669ef7628de75c.zip
CMake-7147c3e1cc23953abc968e9502669ef7628de75c.tar.gz
CMake-7147c3e1cc23953abc968e9502669ef7628de75c.tar.bz2
ENH: add COPY_FILE argument to TRY_COMPILE, so the compiled executable can
be used e.g. for getting strings out of it. Alex
Diffstat (limited to 'Tests/TryCompile/CMakeLists.txt')
-rw-r--r--Tests/TryCompile/CMakeLists.txt11
1 files changed, 10 insertions, 1 deletions
diff --git a/Tests/TryCompile/CMakeLists.txt b/Tests/TryCompile/CMakeLists.txt
index 0de616f..02359fe 100644
--- a/Tests/TryCompile/CMakeLists.txt
+++ b/Tests/TryCompile/CMakeLists.txt
@@ -1,13 +1,22 @@
PROJECT(TryCompile)
# try to compile a file that should compile
+# also check that COPY_FILE works
TRY_COMPILE(SHOULD_PASS
${TryCompile_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp
${TryCompile_SOURCE_DIR}/pass.c
- OUTPUT_VARIABLE TRY_OUT)
+ OUTPUT_VARIABLE TRY_OUT
+ COPY_FILE ${TryCompile_BINARY_DIR}/CopyOfPass
+ )
+
IF(NOT SHOULD_PASS)
MESSAGE(SEND_ERROR "should pass failed ${TRY_OUT}")
ENDIF(NOT SHOULD_PASS)
+IF(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass")
+ MESSAGE(SEND_ERROR "COPY_FILE to \"${TryCompile_BINARY_DIR}/CopyOfPass\" failed")
+ELSE(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass")
+ FILE(REMOVE "${TryCompile_BINARY_DIR}/CopyOfPass")
+ENDIF(NOT EXISTS "${TryCompile_BINARY_DIR}/CopyOfPass")
# try to compile a file that should not compile
TRY_COMPILE(SHOULD_FAIL