diff options
author | Bill Hoffman <bill.hoffman@kitware.com> | 2007-05-10 14:05:52 (GMT) |
---|---|---|
committer | Bill Hoffman <bill.hoffman@kitware.com> | 2007-05-10 14:05:52 (GMT) |
commit | 1f286c067f564372afc10b7d8d294aa3350bc150 (patch) | |
tree | 658e9c9a836d75f823d188e086301ac6571243dc | |
parent | 3e3413dadc3986d2f35cf6a8233125225bee2455 (diff) | |
download | CMake-1f286c067f564372afc10b7d8d294aa3350bc150.zip CMake-1f286c067f564372afc10b7d8d294aa3350bc150.tar.gz CMake-1f286c067f564372afc10b7d8d294aa3350bc150.tar.bz2 |
ENH: add test for build depends
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 42 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/bar.c | 5 |
2 files changed, 31 insertions, 16 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 7b36dc2..ed2f10c 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -13,19 +13,24 @@ try_compile(RESULT ${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) +set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX}) +message("${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") +if(EXISTS + "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found debug") + set(bar + "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") +endif(EXISTS + "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") +message("running ${bar} ") +execute_process(COMMAND ${bar} OUTPUT_VARIABLE out TIMEOUT 3) +string(REGEX REPLACE "[\r\n]" " " out "${out}") message("${out}") -if("${out}" STREQUAL "foo") +if("${out}" STREQUAL "foo ") message("Worked!") -else("${out}" STREQUAL "foo") - message(SEND_ERROR "Program did not rebuild with changed file") -endif("${out}" STREQUAL "foo") +else("${out}" STREQUAL "foo ") + message(SEND_ERROR "Program did not rebuild with changed file: ${out}") +endif("${out}" STREQUAL "foo ") write_file(${BuildDepends_BINARY_DIR}/Project/foo.c "const char* foo() { return \"foo changed\";}" ) @@ -35,11 +40,18 @@ try_compile(RESULT testRebuild OUTPUT_VARIABLE OUTPUT) -execute_process(COMMAND ${bar} OUTPUT_VARIABLE out) +if(EXISTS + "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found debug") +endif(EXISTS + "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}") + +execute_process(COMMAND ${bar} OUTPUT_VARIABLE out TIMEOUT 3) +string(REGEX REPLACE "[\r\n]" " " out "${out}") message("${out}") -if("${out}" STREQUAL "foo changed") +if("${out}" STREQUAL "foo changed ") message("Worked!") -else("${out}" STREQUAL "foo changed") +else("${out}" STREQUAL "foo changed ") message(SEND_ERROR "Program did not rebuild with changed file") -endif("${out}" STREQUAL "foo changed") +endif("${out}" STREQUAL "foo changed ") diff --git a/Tests/BuildDepends/Project/bar.c b/Tests/BuildDepends/Project/bar.c index d32ea2e..4764af5 100644 --- a/Tests/BuildDepends/Project/bar.c +++ b/Tests/BuildDepends/Project/bar.c @@ -3,6 +3,9 @@ const char* foo(); int main() { - printf("%s", foo()); + int i; + printf("%s\n", foo()); + fflush(stdout); + for(;;); return 0; } |