[Cmake-commits] [cmake-commits] hoffman committed CMakeLists.txt 1.12 1.13
cmake-commits at cmake.org
cmake-commits at cmake.org
Tue Jul 15 10:04:04 EDT 2008
Update of /cvsroot/CMake/CMake/Tests/TryCompile
In directory public:/mounts/ram/cvs-serv5959
Modified Files:
CMakeLists.txt
Log Message:
ENH: add a test for bug 7316
Index: CMakeLists.txt
===================================================================
RCS file: /cvsroot/CMake/CMake/Tests/TryCompile/CMakeLists.txt,v
retrieving revision 1.12
retrieving revision 1.13
diff -C 2 -d -r1.12 -r1.13
*** CMakeLists.txt 25 Mar 2008 15:27:13 -0000 1.12
--- CMakeLists.txt 15 Jul 2008 14:04:01 -0000 1.13
***************
*** 26,29 ****
--- 26,62 ----
ENDMACRO(TEST_EXPECT_CONTAINS command expected)
+
+ # Write a simple test program with an include file
+ WRITE_FILE( ${CMAKE_BINARY_DIR}/CMakeTmp/my_include.h "#define TEST_VALUE 0\n")
+ WRITE_FILE( ${CMAKE_BINARY_DIR}/my_test.cxx "#include \"my_include.h\"\nint main() { return TEST_VALUE; }")
+
+ SET(INC_STRING "-I \"${CMAKE_BINARY_DIR}/CMakeTmp\"")
+ # Removing the quotes fixes the Xcode 3 bug, but this
+ # will fail if ${CMAKE_BINARY_DIR} contains an spaces
+ # SET(INC_STRING "-I ${CMAKE_BINARY_DIR}/CMakeTmp")
+
+ TRY_RUN(my_test my_test_COMPILED
+ ${CMAKE_BINARY_DIR}
+ ${CMAKE_BINARY_DIR}/my_test.cxx
+ CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${INC_STRING}
+ OUTPUT_VARIABLE OUTPUT)
+
+
+ # Display the results of the test and write compilation errors to a log
+ IF(NOT my_test_COMPILED)
+ MESSAGE(FATAL_ERROR "Performing Try-Run - Test Compilation Failed")
+ WRITE_FILE(${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeError.log
+ "Performing Try-Run my_test failed to compile with the following output:\n"
+ "${OUTPUT}\n" APPEND)
+ ELSE(NOT my_test_COMPILED)
+ IF(my_test)
+ MESSAGE("The test compiled but failed at run time")
+ ELSE(my_test)
+ MESSAGE("The test compiled and passed")
+ ENDIF(my_test)
+ ENDIF(NOT my_test_COMPILED)
+
+
+
# try to compile a file that should compile
# also check that COPY_FILE works
More information about the Cmake-commits
mailing list