summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2019-10-03 13:08:56 (GMT)
committerKitware Robot <kwrobot@kitware.com>2019-10-03 13:09:04 (GMT)
commit96bc0a5d99b66868f12eb5da94c083c19fa4ebc5 (patch)
tree137cf87815fbadbaf3bdddaad99254dd98949ae6
parent53dedbd51e985ca515b7454520b7c5edd2eaf912 (diff)
parent333a2ff0990f73b1d8242d55777c497626afeaea (diff)
downloadCMake-96bc0a5d99b66868f12eb5da94c083c19fa4ebc5.zip
CMake-96bc0a5d99b66868f12eb5da94c083c19fa4ebc5.tar.gz
CMake-96bc0a5d99b66868f12eb5da94c083c19fa4ebc5.tar.bz2
Merge topic 'xcode-scheme-custom-target'
333a2ff099 Merge branch 'backport-xcode-scheme-custom-target' 7cccc5b199 Xcode: Restore CMAKE_XCODE_GENERATE_SCHEME for custom targets ac9934406d Xcode: Restore CMAKE_XCODE_GENERATE_SCHEME for custom targets Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !3878
-rw-r--r--Source/cmTarget.cxx7
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake10
-rw-r--r--Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake2
3 files changed, 18 insertions, 1 deletions
diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx
index c565bde..99c16f2 100644
--- a/Source/cmTarget.cxx
+++ b/Source/cmTarget.cxx
@@ -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 = {
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
index 88077b3..7d83a70 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake
@@ -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")
diff --git a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
index 73ef5ca..be219f4 100644
--- a/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
+++ b/Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake
@@ -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)