diff options
author | Brad King <brad.king@kitware.com> | 2020-05-13 16:12:12 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2020-05-13 16:12:28 (GMT) |
commit | b07bc05961166170c352163d95f96c0cb80cdae1 (patch) | |
tree | 1e8c829bc1fbfa32593d0d2f2f2555d6155b59de /Tests | |
parent | 44ae68d976ecd1ac721967a2fde241e24f2d7d12 (diff) | |
parent | 0199dd9f1b48b47ae63547ffe737ea9169caf511 (diff) | |
download | CMake-b07bc05961166170c352163d95f96c0cb80cdae1.zip CMake-b07bc05961166170c352163d95f96c0cb80cdae1.tar.gz CMake-b07bc05961166170c352163d95f96c0cb80cdae1.tar.bz2 |
Merge topic 'fix-cache-args-file-to-dep-list' into release-3.17
0199dd9f1b ExternalProject: expose _ep_cache_args_script to the caller
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !4710
Diffstat (limited to 'Tests')
7 files changed, 48 insertions, 0 deletions
diff --git a/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt new file mode 100644 index 0000000..57a0f6e --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProject/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.12) +project(External NONE) + +if (DEFINED cache_arg) + message("configured with: ${cache_arg}") +else () + message("cache_arg is undefined") +endif () + +if (DEFINED second_cache_arg) + message("configured again with: ${second_cache_arg}") +else () + message("second_cache_arg is undefined") +endif () diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt new file mode 100644 index 0000000..fea7fd9 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build1-stdout.txt @@ -0,0 +1,2 @@ +.*configured with: first +.*second_cache_arg is undefined diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt new file mode 100644 index 0000000..e19e743 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs-build2-stdout.txt @@ -0,0 +1,2 @@ +.*configured with: first +.*configured again with: second diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake new file mode 100644 index 0000000..fe69426 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.cmake @@ -0,0 +1,19 @@ +include("${CMAKE_CURRENT_BINARY_DIR}/data.cmake") + +include(ExternalProject) +ExternalProject_add(external + SOURCE_DIR "${CMAKE_CURRENT_LIST_DIR}/ExternalProject" + CMAKE_CACHE_ARGS + ${cache_args} + BUILD_COMMAND "" + INSTALL_COMMAND "") + +set(cache_args_path "<TMP_DIR>/external-cache-$<CONFIG>.cmake") +set(cmake_cache_path "<BINARY_DIR>/CMakeCache.txt") +_ep_replace_location_tags(external cache_args_path cmake_cache_path) + +file(GENERATE OUTPUT "${CMAKE_CURRENT_BINARY_DIR}/check-$<LOWER_CASE:$<CONFIG>>.cmake" CONTENT " +set(check_pairs + \"${cmake_cache_path}|${cache_args_path}\" +) +") diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake new file mode 100644 index 0000000..57c7ab7 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step1.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake" + "set(cache_args -Dcache_arg:STRING=first) +") diff --git a/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake new file mode 100644 index 0000000..cbb79e1 --- /dev/null +++ b/Tests/RunCMake/BuildDepends/ExternalProjectCacheArgs.step2.cmake @@ -0,0 +1,3 @@ +file(WRITE "${RunCMake_TEST_BINARY_DIR}/data.cmake" + "set(cache_args -Dsecond_cache_arg:STRING=second) +") diff --git a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake index 14ae243..e4d7177 100644 --- a/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake +++ b/Tests/RunCMake/BuildDepends/RunCMakeTest.cmake @@ -46,6 +46,11 @@ endif() run_BuildDepends(Custom-Symbolic-and-Byproduct) run_BuildDepends(Custom-Always) +set(RunCMake_TEST_OUTPUT_MERGE_save "${RunCMake_TEST_OUTPUT_MERGE}") +set(RunCMake_TEST_OUTPUT_MERGE 1) +run_BuildDepends(ExternalProjectCacheArgs) +set(RunCMake_TEST_OUTPUT_MERGE "${RunCMake_TEST_OUTPUT_MERGE_save}") + # Test header dependencies with a build tree underneath a source tree. set(RunCMake_TEST_SOURCE_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource") set(RunCMake_TEST_BINARY_DIR "${RunCMake_BINARY_DIR}/BuildUnderSource/build") |