From 67200c37b0a124534b3fa74bea9ed057d864ce1e Mon Sep 17 00:00:00 2001 From: Gregor Jasny Date: Tue, 1 Oct 2019 20:53:06 +0200 Subject: xcode: Add XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING property --- Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/XCODE_GENERATE_SCHEME.rst | 3 ++- .../XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst | 13 ++++++++++++ .../dev/xcode-debug-document-versioning.rst | 7 +++++++ ...MAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst | 13 ++++++++++++ Source/cmTarget.cxx | 1 + Source/cmXCodeScheme.cxx | 23 ++++++++++++++++++++-- Source/cmXCodeScheme.h | 5 +++++ 9 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 Help/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst create mode 100644 Help/release/dev/xcode-debug-document-versioning.rst create mode 100644 Help/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 8f8cb33..3fe609b 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -375,6 +375,7 @@ Properties on Targets /prop_tgt/XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN /prop_tgt/XCODE_SCHEME_ARGUMENTS /prop_tgt/XCODE_SCHEME_DEBUG_AS_ROOT + /prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING /prop_tgt/XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER /prop_tgt/XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS /prop_tgt/XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index def63e4..0442d89 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -234,6 +234,7 @@ Variables that Change Behavior /variable/CMAKE_XCODE_GENERATE_TOP_LEVEL_PROJECT_ONLY /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER /variable/CMAKE_XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN + /variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING /variable/CMAKE_XCODE_SCHEME_DISABLE_MAIN_THREAD_CHECKER /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LIBRARY_LOADS /variable/CMAKE_XCODE_SCHEME_DYNAMIC_LINKER_API_USAGE diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst index 0adb5db..0e182cf 100644 --- a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst +++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst @@ -31,9 +31,10 @@ at target creation time. - :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS` The following target properties will be applied on the -"Info" and "Arguments" tab: +"Info", "Arguments", and "Options" tab: - :prop_tgt:`XCODE_SCHEME_ARGUMENTS` - :prop_tgt:`XCODE_SCHEME_DEBUG_AS_ROOT` +- :prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING` - :prop_tgt:`XCODE_SCHEME_ENVIRONMENT` - :prop_tgt:`XCODE_SCHEME_EXECUTABLE` diff --git a/Help/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst b/Help/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst new file mode 100644 index 0000000..9afeedd --- /dev/null +++ b/Help/prop_tgt/XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst @@ -0,0 +1,13 @@ +XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING +-------------------------------------- + +Whether to enable +``Allow debugging when using document Versions Browser`` +in the Options section of the generated Xcode scheme. + +This property is initialized by the value of the variable +:variable:`CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING` +if it is set when a target is created. + +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property +documentation to see all Xcode schema related properties. diff --git a/Help/release/dev/xcode-debug-document-versioning.rst b/Help/release/dev/xcode-debug-document-versioning.rst new file mode 100644 index 0000000..15aed4f --- /dev/null +++ b/Help/release/dev/xcode-debug-document-versioning.rst @@ -0,0 +1,7 @@ +xcode-debug-document-versioning +------------------------------- + +* The Xcode generator learnt to set the value of the + ``Allow debugging when using document Versions Browser`` schema + option with the :prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING` + target property. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst b/Help/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst new file mode 100644 index 0000000..a264d36 --- /dev/null +++ b/Help/variable/CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING.rst @@ -0,0 +1,13 @@ +CMAKE_XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING +-------------------------------------------- + +Whether to enable +``Allow debugging when using document Versions Browser`` +in the Options section of the generated Xcode scheme. + +This variable initializes the +:prop_tgt:`XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING` +property on all targets. + +Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property +documentation to see all Xcode schema related properties. diff --git a/Source/cmTarget.cxx b/Source/cmTarget.cxx index ae77d9e..7a2ecc2 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -360,6 +360,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("XCODE_GENERATE_SCHEME"); initProp("XCODE_SCHEME_ADDRESS_SANITIZER"); initProp("XCODE_SCHEME_ADDRESS_SANITIZER_USE_AFTER_RETURN"); + initProp("XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING"); initProp("XCODE_SCHEME_THREAD_SANITIZER"); initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP"); initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER"); diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index a1c64ed..afc95f5 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -137,7 +137,9 @@ void cmXCodeScheme::WriteLaunchAction(cmXMLWriter& xout, xout.Attribute("launchStyle", "0"); xout.Attribute("useCustomWorkingDirectory", "NO"); xout.Attribute("ignoresPersistentStateOnLaunch", "NO"); - xout.Attribute("debugDocumentVersioning", "YES"); + WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning", + "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING", + true); xout.Attribute("debugServiceExtension", "internal"); xout.Attribute("allowLocationSimulation", "YES"); @@ -311,6 +313,21 @@ bool cmXCodeScheme::WriteLaunchActionAttribute(cmXMLWriter& xout, return false; } +bool cmXCodeScheme::WriteLaunchActionBooleanAttribute( + cmXMLWriter& xout, const std::string& attrName, const std::string& varName, + bool defaultValue) +{ + auto property = Target->GetTarget()->GetProperty(varName); + bool isOn = (property == nullptr && defaultValue) || cmIsOn(property); + + if (isOn) { + xout.Attribute(attrName.c_str(), "YES"); + } else { + xout.Attribute(attrName.c_str(), "NO"); + } + return isOn; +} + bool cmXCodeScheme::WriteLaunchActionAdditionalOption( cmXMLWriter& xout, const std::string& key, const std::string& value, const std::string& varName) @@ -339,7 +356,9 @@ void cmXCodeScheme::WriteProfileAction(cmXMLWriter& xout, xout.Attribute("shouldUseLaunchSchemeArgsEnv", "YES"); xout.Attribute("savedToolIdentifier", ""); xout.Attribute("useCustomWorkingDirectory", "NO"); - xout.Attribute("debugDocumentVersioning", "YES"); + WriteLaunchActionBooleanAttribute(xout, "debugDocumentVersioning", + "XCODE_SCHEME_DEBUG_DOCUMENT_VERSIONING", + true); xout.EndElement(); } diff --git a/Source/cmXCodeScheme.h b/Source/cmXCodeScheme.h index 1cc5324..dff5e35 100644 --- a/Source/cmXCodeScheme.h +++ b/Source/cmXCodeScheme.h @@ -46,6 +46,11 @@ private: const std::string& attrName, const std::string& varName); + bool WriteLaunchActionBooleanAttribute(cmXMLWriter& xout, + const std::string& attrName, + const std::string& varName, + bool defaultValue); + bool WriteLaunchActionAdditionalOption(cmXMLWriter& xout, const std::string& attrName, const std::string& value, -- cgit v0.12