Skip to content

Commit 694dfef

Browse files
authored
Fix CMAKE_IOS_INSTALL_COMBINED on Xcode 12+ (#609)
* According to https://gitlab.kitware.com/cmake/cmake/-/issues/21282 * Use cmake --install . rather than --build . --target install to avoid database is locked error.
1 parent 6746215 commit 694dfef

File tree

2 files changed

+20
-4
lines changed

2 files changed

+20
-4
lines changed

cmake/schemes/git_tag_cmake.cmake.in

+10-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ if(IOS)
4646
string(COMPARE NOTEQUAL "${IPHONESIMULATOR_ARCHS}" "" has_simulator)
4747
set(ios_opts "-DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO")
4848
if(has_simulator)
49+
if (CMAKE_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_VERSION VERSION_LESS 3.19.5)
50+
hunter_user_error("CMake 3.19.5+ version should be used for CMAKE_IOS_INSTALL_COMBINED on Xcode 12+")
51+
endif()
4952
list(APPEND ios_opts "-DCMAKE_IOS_INSTALL_COMBINED=YES")
5053
endif()
5154
else()
@@ -149,6 +152,12 @@ foreach(configuration ${configuration_types})
149152
set(build_type_opts "-DCMAKE_CONFIGURATION_TYPES=${configuration}")
150153
endif()
151154

155+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
156+
set(cmake_install_command --install .)
157+
else()
158+
set(cmake_install_command --build . --target install)
159+
endif()
160+
152161
ExternalProject_Add(
153162
"${current_project}"
154163
GIT_REPOSITORY
@@ -188,8 +197,7 @@ foreach(configuration ${configuration_types})
188197
${ios_opts}
189198
INSTALL_COMMAND
190199
"@CMAKE_COMMAND@"
191-
--build .
192-
--target install
200+
${cmake_install_command}
193201
--config ${configuration}
194202
COMMAND # Copy license files
195203
"@CMAKE_COMMAND@"

cmake/schemes/url_sha1_cmake.cmake.in

+10-2
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,9 @@ if(IOS)
4646
string(COMPARE NOTEQUAL "${IPHONESIMULATOR_ARCHS}" "" has_simulator)
4747
set(ios_opts "-DCMAKE_XCODE_ATTRIBUTE_ONLY_ACTIVE_ARCH=NO")
4848
if(has_simulator)
49+
if (CMAKE_GENERATOR STREQUAL "Xcode" AND XCODE_VERSION VERSION_GREATER_EQUAL 12 AND CMAKE_VERSION VERSION_LESS 3.19.5)
50+
hunter_user_error("CMake 3.19.5+ version should be used for CMAKE_IOS_INSTALL_COMBINED on Xcode 12+")
51+
endif()
4952
list(APPEND ios_opts "-DCMAKE_IOS_INSTALL_COMBINED=YES")
5053
endif()
5154
else()
@@ -149,6 +152,12 @@ foreach(configuration ${configuration_types})
149152
set(build_type_opts "-DCMAKE_CONFIGURATION_TYPES=${configuration}")
150153
endif()
151154

155+
if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
156+
set(cmake_install_command --install .)
157+
else()
158+
set(cmake_install_command --build . --target install)
159+
endif()
160+
152161
ExternalProject_Add(
153162
"${current_project}"
154163
URL
@@ -187,8 +196,7 @@ foreach(configuration ${configuration_types})
187196
${ios_opts}
188197
INSTALL_COMMAND
189198
"@CMAKE_COMMAND@"
190-
--build .
191-
--target install
199+
${cmake_install_command}
192200
--config ${configuration}
193201
COMMAND # Copy license files
194202
"@CMAKE_COMMAND@"

0 commit comments

Comments
 (0)