diff options
Diffstat (limited to 'Tests/BuildDepends/CMakeLists.txt')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 27927512a..06871543f 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -53,6 +53,8 @@ write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot.hxx.in "static const char* zot = \"zot\";\n") +file(WRITE ${BuildDepends_BINARY_DIR}/Project/dir/header.txt + "#define HEADER_STRING \"ninja\"\n" ) file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_custom.hxx.in "static const char* zot_custom = \"zot_custom\";\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_macro_dir.hxx @@ -93,6 +95,26 @@ if(NOT RESULT) message(SEND_ERROR "Could not build test project (1)!") endif() +# find and save the ninjadep executable +set(ninjadep ${BuildDepends_BINARY_DIR}/Project/ninjadep${CMAKE_EXECUTABLE_SUFFIX}) +if(EXISTS + "${BuildDepends_BINARY_DIR}/Project/Debug/ninjadep${CMAKE_EXECUTABLE_SUFFIX}" ) + message("found debug") + set(ninjadep + "${BuildDepends_BINARY_DIR}/Project/Debug/ninjadep${CMAKE_EXECUTABLE_SUFFIX}") +endif() +message("Running ${ninjadep} ") +execute_process(COMMAND ${ninjadep} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) +string(REGEX REPLACE "[\r\n]" " " out "${out}") +message("Run result: ${runResult} Output: \"${out}\"") + +if("${out}" STREQUAL "HEADER_STRING: ninja ") + message("Worked!") +else() + message(SEND_ERROR "Project did not rebuild properly. Output[${out}]\n" + " expected [HEADER_STRING: ninja]") +endif() + set(bar ${BuildDepends_BINARY_DIR}/Project/bar${CMAKE_EXECUTABLE_SUFFIX}) if(EXISTS "${BuildDepends_BINARY_DIR}/Project/Debug/bar${CMAKE_EXECUTABLE_SUFFIX}" ) @@ -151,6 +173,8 @@ execute_process(COMMAND ${bar} -infinite TIMEOUT 3 OUTPUT_VARIABLE out) message("Modifying Project/foo.cxx") write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx "const char* foo() { return \"foo changed\";}" ) +file(WRITE "${BuildDepends_BINARY_DIR}/Project/dir/header.txt" + "#define HEADER_STRING \"ninja changed\"\n" ) file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot.hxx.in "static const char* zot = \"zot changed\";\n") file(WRITE ${BuildDepends_BINARY_DIR}/Project/zot_custom.hxx.in @@ -204,6 +228,21 @@ if(EXISTS message("found debug") endif() +message("Running ${ninjadep} ") +execute_process(COMMAND ${ninjadep} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) +string(REGEX REPLACE "[\r\n]" " " out "${out}") +message("Run result: ${runResult} Output: \"${out}\"") + +if("${out}" STREQUAL "HEADER_STRING: ninja changed ") + message("Worked!") +elseif(CMAKE_GENERATOR STREQUAL "Visual Studio 6") + # Tolerate failure because VS 6 does not seem to recompile ninjadep.cpp + # when the "dir/header.h" it includes changes. +else() + message(SEND_ERROR "Project did not rebuild properly. Output[${out}]\n" + " expected [HEADER_STRING: ninja changed]") +endif() + message("Running ${bar} ") execute_process(COMMAND ${bar} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) string(REGEX REPLACE "[\r\n]" " " out "${out}") @@ -246,6 +285,8 @@ if(EXISTS "${link_depends_no_shared_check_txt}") file(STRINGS "${link_depends_no_shared_check_txt}" link_depends_no_shared_check LIMIT_COUNT 1) if("${link_depends_no_shared_check}" STREQUAL "0") message(STATUS "link_depends_no_shared_exe is older than link_depends_no_shared_lib as expected.") + elseif(XCODE AND NOT XCODE_VERSION VERSION_LESS 5) + message(STATUS "Known limitation: link_depends_no_shared_exe is newer than link_depends_no_shared_lib but we cannot stop Xcode ${XCODE_VERSION} from enforcing this dependency.") else() message(SEND_ERROR "Project did not rebuild properly: link_depends_no_shared_exe is newer than link_depends_no_shared_lib.") endif() |