diff options
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 8 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 4 | ||||
-rw-r--r-- | Source/cmTarget.cxx | 7 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeSchemaProperty-check.cmake | 10 | ||||
-rw-r--r-- | Tests/RunCMake/XcodeProject/XcodeSchemaProperty.cmake | 2 |
5 files changed, 28 insertions, 3 deletions
diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index 02bc14b..d9002fb 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -284,7 +284,13 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} set(id_cl icl.exe) endif() if(CMAKE_VS_PLATFORM_TOOLSET_VERSION) - set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build\\${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />") + if(CMAKE_VS_PLATFORM_TOOLSET_VERSION VERSION_GREATER_EQUAL "14.20") + set(id_sep ".") + else() + set(id_sep "\\") + endif() + set(id_toolset_version_props "<Import Project=\"${CMAKE_GENERATOR_INSTANCE}\\VC\\Auxiliary\\Build${id_sep}${CMAKE_VS_PLATFORM_TOOLSET_VERSION}\\Microsoft.VCToolsVersion.${CMAKE_VS_PLATFORM_TOOLSET_VERSION}.props\" />") + unset(id_sep) endif() endif() else() diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 2ba1aff..1eca1f6 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -390,7 +390,9 @@ std::string cmGlobalVisualStudioVersionedGenerator::GetAuxiliaryToolset() const GetVSInstance(instancePath); std::stringstream path; path << instancePath; - path << "/VC/Auxiliary/Build/"; + path << "/VC/Auxiliary/Build"; + path << (cmSystemTools::VersionCompareGreaterEq(version, "14.20") ? '.' + : '/'); path << version; path << "/Microsoft.VCToolsVersion." << version << ".props"; diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index a67122c..98c66da 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -334,7 +334,6 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, InitProperty("VS_JUST_MY_CODE_DEBUGGING", nullptr); #ifdef __APPLE__ if (this->GetGlobalGenerator()->IsXcode()) { - InitProperty("XCODE_GENERATE_SCHEME", nullptr); InitProperty("XCODE_SCHEME_ADDRESS_SANITIZER", nullptr); InitProperty("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN", nullptr); InitProperty("XCODE_SCHEME_THREAD_SANITIZER", nullptr); @@ -354,6 +353,12 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, #endif } + if (this->GetType() != cmStateEnums::INTERFACE_LIBRARY) { + if (this->GetGlobalGenerator()->IsXcode()) { + InitProperty("XCODE_GENERATE_SCHEME", nullptr); + } + } + // 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) |