diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-05-09 19:10:12 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-05-09 19:10:12 (GMT) |
commit | d4193542509722b169d33ddd5a8d081522bd789c (patch) | |
tree | 09fc12abfe5be3b5206c758d66f2a9e85aefed49 /Tests/BuildDepends | |
parent | 8245f437b6528cfa86dda12e566a32c810f2d64a (diff) | |
download | CMake-d4193542509722b169d33ddd5a8d081522bd789c.zip CMake-d4193542509722b169d33ddd5a8d081522bd789c.tar.gz CMake-d4193542509722b169d33ddd5a8d081522bd789c.tar.bz2 |
ENH: add a test to make sure Xcode does not break again
Diffstat (limited to 'Tests/BuildDepends')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 45 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/CMakeLists.txt | 4 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/bar.c | 8 |
3 files changed, 57 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt new file mode 100644 index 0000000..7b36dc2 --- /dev/null +++ b/Tests/BuildDepends/CMakeLists.txt @@ -0,0 +1,45 @@ +# 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") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt new file mode 100644 index 0000000..2546038 --- /dev/null +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -0,0 +1,4 @@ +project(testRebuild) +add_library(foo STATIC ${testRebuild_BINARY_DIR}/foo.c) +add_executable(bar bar.c) +target_link_libraries(bar foo) diff --git a/Tests/BuildDepends/Project/bar.c b/Tests/BuildDepends/Project/bar.c new file mode 100644 index 0000000..d32ea2e --- /dev/null +++ b/Tests/BuildDepends/Project/bar.c @@ -0,0 +1,8 @@ +#include "stdio.h" + +const char* foo(); +int main() +{ + printf("%s", foo()); + return 0; +} |