Skip to content

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

Harry Mallon requested to merge hjmallon/cmake:_hm_ios_combined into master

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.

Original Description

As part of #21282 (comment 1242026) CMake moved to preferring cmake --install . rather than cmake --build . --target install. Installing with IOS_INSTALL_COMBINED enabled is broken otherwise. Here I have updated the default install command in ExternalProject to match.

You can test this with a CMakeLists.txt as follows and an iOS toolchain.

cmake_minimum_required(VERSION 3.19)

project(TestiOS)

include(ExternalProject)
ExternalProject_Add(gtest
  GIT_REPOSITORY    https://github.com/google/googletest.git
  CMAKE_ARGS        "-DCMAKE_IOS_INSTALL_COMBINED=ON" "-DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}" "-DBUILD_GMOCK=OFF"
  GIT_TAG           release-1.11.0
)

Fixes: #23946
Topic-rename: ExternalProject-cmake-install

Edited by Brad King

Merge request reports