summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Modules/ExternalProject.cmake9
-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
5 files changed, 18 insertions, 5 deletions
diff --git a/Modules/ExternalProject.cmake b/Modules/ExternalProject.cmake
index 22a25bd..9306ce6 100644
--- a/Modules/ExternalProject.cmake
+++ b/Modules/ExternalProject.cmake
@@ -1840,11 +1840,7 @@ function(_ep_get_build_command
else()
set(cmd "${CMAKE_COMMAND}")
endif()
- if(step STREQUAL "INSTALL")
- set(args --install ".")
- else()
- set(args --build ".")
- endif()
+ set(args --build ".")
get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(_isMultiConfig)
if (CMAKE_CFG_INTDIR AND
@@ -1866,6 +1862,9 @@ function(_ep_get_build_command
endif()
list(APPEND args --config ${config})
endif()
+ if(step STREQUAL "INSTALL")
+ list(APPEND args --target install)
+ endif()
# But for "TEST" drive the project with corresponding "ctest".
if("x${step}x" STREQUAL "xTESTx")
string(REGEX REPLACE "^(.*/)cmake([^/]*)$" "\\1ctest\\2" cmd "${cmd}")
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)