diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 16 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/CMakeLists.txt | 14 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/dep_custom.cxx | 1 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/zot.cxx | 3 |
4 files changed, 27 insertions, 7 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 428d5ed..90b6b92 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -13,6 +13,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/zot_custom.hxx.in + "static const char* zot_custom = \"zot_custom\";\n") message("Building project first time") try_compile(RESULT @@ -70,11 +72,11 @@ execute_process(COMMAND ${zot} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) string(REGEX REPLACE "[\r\n]" " " out "${out}") message("Run result: ${runResult} Output: \"${out}\"") -if("${out}" STREQUAL "zot ") +if("${out}" STREQUAL "[zot] [zot_custom] ") message("Worked!") -else("${out}" STREQUAL "zot ") +else("${out}" STREQUAL "[zot] [zot_custom] ") message(SEND_ERROR "Project did not initially build properly: ${out}") -endif("${out}" STREQUAL "zot ") +endif("${out}" STREQUAL "[zot] [zot_custom] ") message("Waiting 3 seconds...") # any additional argument will cause ${bar} to wait forever @@ -85,6 +87,8 @@ write_file(${BuildDepends_BINARY_DIR}/Project/foo.cxx "const char* foo() { return \"foo changed\";}" ) 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 + "static const char* zot_custom = \"zot_custom changed\";\n") message("Building project second time") try_compile(RESULT @@ -137,8 +141,8 @@ execute_process(COMMAND ${zot} OUTPUT_VARIABLE out RESULT_VARIABLE runResult) string(REGEX REPLACE "[\r\n]" " " out "${out}") message("Run result: ${runResult} Output: \"${out}\"") -if("${out}" STREQUAL "zot changed ") +if("${out}" STREQUAL "[zot changed] [zot_custom changed] ") message("Worked!") -else("${out}" STREQUAL "zot changed ") +else("${out}" STREQUAL "[zot changed] [zot_custom changed] ") message(SEND_ERROR "Project did not rebuild properly!") -endif("${out}" STREQUAL "zot changed ") +endif("${out}" STREQUAL "[zot changed] [zot_custom changed] ") diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 2651adf..01bbf44 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -32,9 +32,12 @@ add_executable(bar bar.cxx IF("${CMAKE_GENERATOR}" MATCHES "Make") # Test the IMPLICIT_DEPENDS feature. SET(ZOT_DEPENDS IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep.cxx) + SET(ZOT_CUSTOM_DEP + IMPLICIT_DEPENDS CXX ${CMAKE_CURRENT_SOURCE_DIR}/dep_custom.cxx) ELSE("${CMAKE_GENERATOR}" MATCHES "Make") # No IMPLICIT_DEPENDS...just depend directly. SET(ZOT_DEPENDS DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx.in) + SET(ZOT_CUSTOM_DEP DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx.in) ENDIF("${CMAKE_GENERATOR}" MATCHES "Make") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx @@ -44,4 +47,15 @@ add_custom_command( ${ZOT_DEPENDS} ) +add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx + COMMAND ${CMAKE_COMMAND} -E copy + ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx.in + ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx + ${ZOT_CUSTOM_DEP} + ) +add_custom_target(zot_custom ALL DEPENDS + ${CMAKE_CURRENT_BINARY_DIR}/zot_custom.hxx) + add_executable(zot zot.cxx ${CMAKE_CURRENT_BINARY_DIR}/zot.hxx) +add_dependencies(zot zot_custom) diff --git a/Tests/BuildDepends/Project/dep_custom.cxx b/Tests/BuildDepends/Project/dep_custom.cxx new file mode 100644 index 0000000..b6ac548 --- /dev/null +++ b/Tests/BuildDepends/Project/dep_custom.cxx @@ -0,0 +1 @@ +#include <zot_custom.hxx.in> diff --git a/Tests/BuildDepends/Project/zot.cxx b/Tests/BuildDepends/Project/zot.cxx index 703ca38..356b078 100644 --- a/Tests/BuildDepends/Project/zot.cxx +++ b/Tests/BuildDepends/Project/zot.cxx @@ -1,9 +1,10 @@ #include <zot.hxx> +#include <zot_custom.hxx> #include <stdio.h> int main() { - printf("%s\n", zot); + printf("[%s] [%s]\n", zot, zot_custom); fflush(stdout); return 0; } |