mirror of
https://github.com/Kitware/CMake.git
synced 2026-05-13 01:29:02 -05:00
Xcode: Restore CMAKE_XCODE_GENERATE_SCHEME for custom targets
The target property introduced by commit 413b71485a (Xcode: Create Xcode
schemes per target, 2019-03-11, v3.15.0-rc1~347^2) was accidentally not
initialized by `CMAKE_XCODE_GENERATE_SCHEME` for custom targets. Fix it
and update the test.
Fixes: #19759
This commit is contained in:
+6
-1
@@ -364,7 +364,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
initPropValue("UNITY_BUILD_BATCH_SIZE", "8");
|
||||
#ifdef __APPLE__
|
||||
if (this->GetGlobalGenerator()->IsXcode()) {
|
||||
initProp("XCODE_GENERATE_SCHEME");
|
||||
initProp("XCODE_SCHEME_ADDRESS_SANITIZER");
|
||||
initProp("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN");
|
||||
initProp("XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING");
|
||||
@@ -385,6 +384,12 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type,
|
||||
#endif
|
||||
}
|
||||
|
||||
if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) {
|
||||
if (this->GetGlobalGenerator()->IsXcode()) {
|
||||
initProp("XCODE_GENERATE_SCHEME");
|
||||
}
|
||||
}
|
||||
|
||||
// Setup per-configuration property default values.
|
||||
if (this->GetType() != cmStateEnums::UTILITY) {
|
||||
static const auto configProps = {
|
||||
|
||||
@@ -7,6 +7,13 @@ function(check_property property matcher)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(expect_schema target)
|
||||
set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme")
|
||||
if(NOT EXISTS ${schema})
|
||||
message(SEND_ERROR "Missing schema for target ${target}")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(expect_no_schema target)
|
||||
set(schema "${RunCMake_TEST_BINARY_DIR}/XcodeSchemaProperty.xcodeproj/xcshareddata/xcschemes/${target}.xcscheme")
|
||||
if(EXISTS ${schema})
|
||||
@@ -40,3 +47,6 @@ check_property("ENVIRONMENT" [=[key="BAR"]=])
|
||||
check_property("ENVIRONMENT" [=[value="bar"]=])
|
||||
|
||||
expect_no_schema("NoSchema")
|
||||
|
||||
expect_schema("CustomTarget")
|
||||
expect_schema("ALL_BUILD")
|
||||
|
||||
@@ -38,3 +38,5 @@ create_scheme_for_property(ENVIRONMENT "FOO=foo;BAR=bar")
|
||||
|
||||
add_executable(NoSchema main.cpp)
|
||||
set_target_properties(NoSchema PROPERTIES XCODE_GENERATE_SCHEME OFF)
|
||||
|
||||
add_custom_target(CustomTarget)
|
||||
|
||||
Reference in New Issue
Block a user