[cmake-commits] alex committed CMakeLists.txt 1.8 1.9

cmake-commits at cmake.org cmake-commits at cmake.org
Thu May 24 12:07:01 EDT 2007


Update of /cvsroot/CMake/CMake/Tests/TryCompile
In directory public:/mounts/ram/cvs-serv6617/Tests/TryCompile

Modified Files:
	CMakeLists.txt 
Log Message:

ENH: add COPY_FILE argument to TRY_COMPILE, so the compiled executable can
be used e.g. for getting strings out of it.

Alex


Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/TryCompile/CMakeLists.txt,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- CMakeLists.txt	24 May 2007 15:27:51 -0000	1.8
+++ CMakeLists.txt	24 May 2007 16:06:59 -0000	1.9
@@ -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



More information about the Cmake-commits mailing list