Browse Source

ExternalProject: Install CMake projects using 'cmake --install'

In some cases, `cmake --install .` implements additional semantics over
just `cmake --build . --target install`.  For example, using the Xcode
"new build system" with `IOS_INSTALL_COMBINED` requires special support
from `cmake --install` beyond building the `install` target.

Fixes: #23946
Harry Mallon 3 years ago
parent
commit
66b5d51f38
1 changed files with 5 additions and 4 deletions
  1. 5 4
      Modules/ExternalProject.cmake

+ 5 - 4
Modules/ExternalProject.cmake

@@ -1840,7 +1840,11 @@ function(_ep_get_build_command
       else()
         set(cmd "${CMAKE_COMMAND}")
       endif()
-      set(args --build ".")
+      if(step STREQUAL "INSTALL")
+        set(args --install ".")
+      else()
+        set(args --build ".")
+      endif()
       get_property(_isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
       if(_isMultiConfig)
         if (CMAKE_CFG_INTDIR AND
@@ -1862,9 +1866,6 @@ 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}")