[cmake-commits] hoffman committed CMakeLists.txt NONE 1.1

cmake-commits at cmake.org cmake-commits at cmake.org
Wed May 9 15:10:14 EDT 2007


Update of /cvsroot/CMake/CMake/Tests/BuildDepends
In directory public:/mounts/ram/cvs-serv9810

Added Files:
	CMakeLists.txt 
Log Message:
ENH: add a test to make sure Xcode does not break again


--- NEW FILE: CMakeLists.txt ---
# this test creates a static library and an executable
# the source to the library is then changed 
# and the build is done on the executable and if things
# are working the executable should relink with the new
# value.  The subdir Project contains the CMakelists.txt
# and source files for the test project. 
project(BuildDepends)
make_directory(${BuildDepends_BINARY_DIR}/Project)
write_file(${BuildDepends_BINARY_DIR}/Project/foo.c 
  "const char* foo() { return \"foo\";}" )
try_compile(RESULT 
  ${BuildDepends_BINARY_DIR}/Project
  ${BuildDepends_SOURCE_DIR}/Project
  testRebuild
  OUTPUT_VARIABLE OUTPUT)

set(bar ${BuildDepends_BINARY_DIR}/Project/bar.exe)
if(EXISTS ${BuildDepends_BINARY_DIR}/Project/Debug/bar.exe )
  set(bar ${BuildDepends_BINARY_DIR}/Project/Debug/bar.exe)
endif(EXISTS ${BuildDepends_BINARY_DIR}/Project/Debug/bar.exe )
  
execute_process(COMMAND ${bar} OUTPUT_VARIABLE out)
message("${out}")
if("${out}" STREQUAL "foo")
  message("Worked!")
else("${out}" STREQUAL "foo")
  message(SEND_ERROR "Program did not rebuild with changed file")
endif("${out}" STREQUAL "foo")

write_file(${BuildDepends_BINARY_DIR}/Project/foo.c 
  "const char* foo() { return \"foo changed\";}" )
try_compile(RESULT 
  ${BuildDepends_BINARY_DIR}/Project
  ${BuildDepends_SOURCE_DIR}/Project
  testRebuild
  OUTPUT_VARIABLE OUTPUT)

execute_process(COMMAND ${bar} OUTPUT_VARIABLE out)
message("${out}")

if("${out}" STREQUAL "foo changed")
  message("Worked!")
else("${out}" STREQUAL "foo changed")
  message(SEND_ERROR "Program did not rebuild with changed file")
endif("${out}" STREQUAL "foo changed")



More information about the Cmake-commits mailing list