diff options
author | Brad King <brad.king@kitware.com> | 2014-02-24 15:40:07 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-02-24 15:40:07 (GMT) |
commit | 624b0fa923ef669649300e923931730d0bd03ba7 (patch) | |
tree | aa92bddcd47cad1a94dca414d0432cebf17b4942 /Tests | |
parent | 461eaee53ecc1bd8c4239ff2e25fd85f0a5fc126 (diff) | |
parent | 73e5c6aead4d2c748ced061a7de27f2ffc7e2d31 (diff) | |
download | CMake-624b0fa923ef669649300e923931730d0bd03ba7.zip CMake-624b0fa923ef669649300e923931730d0bd03ba7.tar.gz CMake-624b0fa923ef669649300e923931730d0bd03ba7.tar.bz2 |
Merge topic 'ExternalProject-BUILD_ALWAYS'
73e5c6ae ExternalProject: Add option to always run the build step
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/BuildDepends/CMakeLists.txt | 30 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/CMakeLists.txt | 12 | ||||
-rw-r--r-- | Tests/BuildDepends/Project/External/CMakeLists.txt | 14 |
3 files changed, 56 insertions, 0 deletions
diff --git a/Tests/BuildDepends/CMakeLists.txt b/Tests/BuildDepends/CMakeLists.txt index 9727930..a875f07 100644 --- a/Tests/BuildDepends/CMakeLists.txt +++ b/Tests/BuildDepends/CMakeLists.txt @@ -68,6 +68,8 @@ file(WRITE ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_exe.h "#define link_depends_no_shared_exe_value 0\n") set(link_depends_no_shared_check_txt ${BuildDepends_BINARY_DIR}/Project/link_depends_no_shared_check.txt) +file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external original\n") + help_xcode_depends() message("Building project first time") @@ -166,6 +168,19 @@ else() "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) + file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) + if("${external_out}" STREQUAL "external original") + message(STATUS "external.out contains '${external_out}'") + else() + message(SEND_ERROR "Project did not initially build properly: " + "external.out contains '${external_out}'") + endif() +else() + message(SEND_ERROR "Project did not initially build properly: " + "external.out is missing") +endif() + message("Waiting 3 seconds...") # any additional argument will cause ${bar} to wait forever execute_process(COMMAND ${bar} -infinite TIMEOUT 3 OUTPUT_VARIABLE out) @@ -191,6 +206,8 @@ if(TEST_LINK_DEPENDS) file(WRITE ${TEST_LINK_DEPENDS} "2") endif() +file(WRITE ${BuildDepends_BINARY_DIR}/Project/external.in "external changed\n") + help_xcode_depends() message("Building project second time") @@ -294,3 +311,16 @@ else() message(SEND_ERROR "Project did not rebuild properly. " "Targets link_depends_no_shared_lib and link_depends_no_shared_exe not both built.") endif() + +if(EXISTS ${BuildDepends_BINARY_DIR}/Project/external.out) + file(STRINGS ${BuildDepends_BINARY_DIR}/Project/external.out external_out) + if("${external_out}" STREQUAL "external changed") + message(STATUS "external.out contains '${external_out}'") + else() + message(SEND_ERROR "Project did not rebuild properly: " + "external.out contains '${external_out}'") + endif() +else() + message(SEND_ERROR "Project did not rebuild properly: " + "external.out is missing") +endif() diff --git a/Tests/BuildDepends/Project/CMakeLists.txt b/Tests/BuildDepends/Project/CMakeLists.txt index 8806ecd..9ee4a43 100644 --- a/Tests/BuildDepends/Project/CMakeLists.txt +++ b/Tests/BuildDepends/Project/CMakeLists.txt @@ -139,3 +139,15 @@ add_custom_target(header_tgt DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/dir/header.h) include_directories(${CMAKE_CURRENT_BINARY_DIR}) add_executable(ninjadep ninjadep.cpp) add_dependencies(ninjadep header_tgt) + +include(ExternalProject) +ExternalProject_Add(ExternalBuild + SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/External + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR}/External + STAMP_DIR ${CMAKE_CURRENT_BINARY_DIR}/External/Stamp + BUILD_ALWAYS 1 + CMAKE_ARGS + -Dexternal_in=${CMAKE_CURRENT_BINARY_DIR}/external.in + -Dexternal_out=${CMAKE_CURRENT_BINARY_DIR}/external.out + INSTALL_COMMAND "" + ) diff --git a/Tests/BuildDepends/Project/External/CMakeLists.txt b/Tests/BuildDepends/Project/External/CMakeLists.txt new file mode 100644 index 0000000..c6015b6 --- /dev/null +++ b/Tests/BuildDepends/Project/External/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.0) +project(BuildDependsExternal NONE) +if(NOT DEFINED external_in) + message(FATAL_ERROR "Define external_in") +endif() +if(NOT DEFINED external_out) + message(FATAL_ERROR "Define external_out") +endif() +add_custom_command( + OUTPUT ${external_out} + COMMAND ${CMAKE_COMMAND} -E copy ${external_in} ${external_out} + DEPENDS ${external_in} + ) +add_custom_target(drive ALL DEPENDS ${external_out}) |