summaryrefslogtreecommitdiffstats
path: root/Tests
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2023-03-02 18:46:44 (GMT)
committerBrad King <brad.king@kitware.com>2023-03-02 19:28:26 (GMT)
commit771387523a02e0c1ef5f68d20e9efc210b19c868 (patch)
treef6fe6fe687a42bd20bede30358d0cfeeca818375 /Tests
parente2f1d6e7bdc398530fdd61b996ba1a87ecc54044 (diff)
downloadCMake-771387523a02e0c1ef5f68d20e9efc210b19c868.zip
CMake-771387523a02e0c1ef5f68d20e9efc210b19c868.tar.gz
CMake-771387523a02e0c1ef5f68d20e9efc210b19c868.tar.bz2
ExternalProject: Restore driving install through build system
Revert commit 66b5d51f38 (ExternalProject: Install CMake projects using 'cmake --install', 2022-09-08, v3.25.0-rc1~150^2). It changed the ExternalProject install step command from: cmake --build <dir> --target install --config <cfg> to: cmake --install <dir> --config <cfg> The latter command no longer runs the external project build system during the install step. We could consider using the commands: cmake --build <dir> --target all --config <cfg> cmake --install <dir> --config <cfg> as the install step, but if `CMAKE_SKIP_INSTALL_ALL_DEPENDENCY` is used in the external project, that can change semantics too. Revert the original change pending further investigation on other ways to support its motivating use case. Add a test covering the previously-regressed use case. Fixes: #24567 Issue: #23946
Diffstat (limited to 'Tests')
-rw-r--r--Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt2
-rw-r--r--Tests/RunCMake/ExternalProject/InstallBuilds.cmake7
-rw-r--r--Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt4
-rw-r--r--Tests/RunCMake/ExternalProject/RunCMakeTest.cmake1
4 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt b/Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt
new file mode 100644
index 0000000..9618ee3
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/InstallBuilds-build-stdout.txt
@@ -0,0 +1,2 @@
+.*build command suppressed
+.*always builds
diff --git a/Tests/RunCMake/ExternalProject/InstallBuilds.cmake b/Tests/RunCMake/ExternalProject/InstallBuilds.cmake
new file mode 100644
index 0000000..405a61a
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/InstallBuilds.cmake
@@ -0,0 +1,7 @@
+include(ExternalProject)
+
+ExternalProject_Add(InstallBuilds
+ SOURCE_DIR ${CMAKE_CURRENT_LIST_DIR}/InstallBuilds
+ DOWNLOAD_COMMAND ""
+ BUILD_COMMAND "${CMAKE_COMMAND}" -E echo "build command suppressed"
+ )
diff --git a/Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt b/Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt
new file mode 100644
index 0000000..2158cdd
--- /dev/null
+++ b/Tests/RunCMake/ExternalProject/InstallBuilds/CMakeLists.txt
@@ -0,0 +1,4 @@
+cmake_minimum_required(VERSION 3.24)
+project(InstallBuilds NONE)
+add_custom_target(always ALL COMMAND ${CMAKE_COMMAND} -E echo "always builds")
+install(CODE "")
diff --git a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
index f152f5b..4afdef8 100644
--- a/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
+++ b/Tests/RunCMake/ExternalProject/RunCMakeTest.cmake
@@ -147,6 +147,7 @@ endfunction()
__ep_test_with_build(MultiCommand)
set(RunCMake_TEST_OUTPUT_MERGE 1)
+__ep_test_with_build(InstallBuilds)
__ep_test_with_build(PreserveEmptyArgs)
set(RunCMake_TEST_OUTPUT_MERGE 0)