IOS_INSTALL_COMBINED / CMAKE_IOS_INSTALL_COMBINED fails due to install ordering
CMAKE_IOS_INSTALL_COMBINED tries to install each target, then build the simulator version, then install that with lipo. When a repo has multiple targets and building one might rebuild the others the files can be replaced before they are installed.
Intended flow (A & B are libraries, device means iOS device arm64, sim means iOS simulator x86_64)
- Build A device
- Build B device
- Install A device
- Build A sim
- Lipo A device and A sim in install dir
- Install B device
- Build B sim
- Lipo B device and B sim in install dir
Here is what actually happens:
- Build A device
- Build B device
- Install A device
- Build A sim
- Dependancy on B forces: Build B sim
- Lipo A device and A sim in install dir
- Install B sim (as it has replaced B device)
- Build B sim
- Lipo 2 x B sim in install dir (fails in IOS_INSTALL_COMBINED)
This should be quite easy to reproduce. I was able to reporduce with GTest 1.11.0 (https://github.com/google/googletest/archive/release-1.11.0.tar.gz). I am using 3.23.1 and Xcode 13.4.1.
cmake -GXcode -DCMAKE_SYSTEM_NAME="iOS" \
-DCMAKE_INSTALL_PREFIX=install \
-DCMAKE_IOS_INSTALL_COMBINED=ON \
'-D"CMAKE_XCODE_ATTRIBUTE_EXCLUDED_ARCHS[sdk=iphonesimulator*]"=arm64' \
-DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO \
../
cmake --build . --config Release
cmake --install .