From 740bee97bd131b2497c58101f7fc84b1a10a8aa6 Mon Sep 17 00:00:00 2001 From: PatriceJiang <397136899@qq.com> Date: Thu, 18 Aug 2022 11:53:52 +0800 Subject: Xcode: Add settings to control a scheme's launch configuration --- Auxiliary/vim/syntax/cmake.vim | 2 ++ Help/manual/cmake-properties.7.rst | 1 + Help/manual/cmake-variables.7.rst | 1 + Help/prop_tgt/XCODE_GENERATE_SCHEME.rst | 1 + Help/prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION.rst | 13 +++++++++++++ Help/release/dev/xcode-launch-mode.rst | 5 +++++ Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION.rst | 12 ++++++++++++ Source/cmTarget.cxx | 1 + Source/cmXCodeScheme.cxx | 7 ++++++- 9 files changed, 42 insertions(+), 1 deletion(-) create mode 100644 Help/prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION.rst create mode 100644 Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION.rst diff --git a/Auxiliary/vim/syntax/cmake.vim b/Auxiliary/vim/syntax/cmake.vim index 0f281d5..e8cec8a 100644 --- a/Auxiliary/vim/syntax/cmake.vim +++ b/Auxiliary/vim/syntax/cmake.vim @@ -447,6 +447,7 @@ syn keyword cmakeProperty contained \ XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP \ XCODE_SCHEME_ENABLE_GPU_API_VALIDATION \ XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + \ XCODE_SCHEME_LAUNCH_CONFIGURATION \ XCODE_SCHEME_WORKING_DIRECTORY \ XCODE_SCHEME_ZOMBIE_OBJECTS \ XCTEST @@ -1551,6 +1552,7 @@ syn keyword cmakeVariable contained \ CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP \ CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION \ CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + \ CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION \ CMAKE_XCODE_SCHEME_WORKING_DIRECTORY \ CMAKE_XCODE_SCHEME_ZOMBIE_OBJECTS \ CPACK_ABSOLUTE_DESTINATION_FILES diff --git a/Help/manual/cmake-properties.7.rst b/Help/manual/cmake-properties.7.rst index 19a22bb..d98f7cc 100644 --- a/Help/manual/cmake-properties.7.rst +++ b/Help/manual/cmake-properties.7.rst @@ -476,6 +476,7 @@ Properties on Targets /prop_tgt/XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP /prop_tgt/XCODE_SCHEME_ENABLE_GPU_API_VALIDATION /prop_tgt/XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION + /prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION /prop_tgt/XCODE_SCHEME_WORKING_DIRECTORY /prop_tgt/XCODE_SCHEME_ZOMBIE_OBJECTS /prop_tgt/XCODE_XCCONFIG diff --git a/Help/manual/cmake-variables.7.rst b/Help/manual/cmake-variables.7.rst index 658a209..28bbfe7 100644 --- a/Help/manual/cmake-variables.7.rst +++ b/Help/manual/cmake-variables.7.rst @@ -287,6 +287,7 @@ Variables that Change Behavior /variable/CMAKE_XCODE_SCHEME_THREAD_SANITIZER_STOP /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER /variable/CMAKE_XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP + /variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION /variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_API_VALIDATION /variable/CMAKE_XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION /variable/CMAKE_XCODE_SCHEME_WORKING_DIRECTORY diff --git a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst index ec288f3..fa3c5bc 100644 --- a/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst +++ b/Help/prop_tgt/XCODE_GENERATE_SCHEME.rst @@ -30,6 +30,7 @@ at target creation time. - :prop_tgt:`XCODE_SCHEME_THREAD_SANITIZER_STOP` - :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER` - :prop_tgt:`XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP` +- :prop_tgt:`XCODE_SCHEME_LAUNCH_CONFIGURATION` - :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_API_VALIDATION` - :prop_tgt:`XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION` - :prop_tgt:`XCODE_SCHEME_ZOMBIE_OBJECTS` diff --git a/Help/prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION.rst b/Help/prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION.rst new file mode 100644 index 0000000..9643322 --- /dev/null +++ b/Help/prop_tgt/XCODE_SCHEME_LAUNCH_CONFIGURATION.rst @@ -0,0 +1,13 @@ +XCODE_SCHEME_LAUNCH_CONFIGURATION +--------------------------------- + +.. versionadded:: 3.25 + +Set the build configuration to run the target. + +This property is initialized by the value of the variable +:variable:`CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION` +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-launch-mode.rst b/Help/release/dev/xcode-launch-mode.rst index 32b9ee6..701b502 100644 --- a/Help/release/dev/xcode-launch-mode.rst +++ b/Help/release/dev/xcode-launch-mode.rst @@ -5,3 +5,8 @@ xcode-launch-mode :prop_tgt:`XCODE_SCHEME_LAUNCH_MODE` target property were added to tell the :generator:`Xcode` generator what to put in the scheme's "Launch" mode setting. + +* The :variable:`CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION` variable and + corresponding :prop_tgt:`XCODE_SCHEME_LAUNCH_CONFIGURATION` target + property were added to tell the :generator:`Xcode` generator what + configuration to put in the scheme's Launch action. diff --git a/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION.rst b/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION.rst new file mode 100644 index 0000000..e5b4d18 --- /dev/null +++ b/Help/variable/CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION.rst @@ -0,0 +1,12 @@ +CMAKE_XCODE_SCHEME_LAUNCH_CONFIGURATION +--------------------------------------- + +.. versionadded:: 3.25 + +Set the build configuration to run the target. + +This variable initializes the :prop_tgt:`XCODE_SCHEME_LAUNCH_CONFIGURATION` +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 8dc69fb..3448c94 100644 --- a/Source/cmTarget.cxx +++ b/Source/cmTarget.cxx @@ -620,6 +620,7 @@ cmTarget::cmTarget(std::string const& name, cmStateEnums::TargetType type, initProp("XCODE_SCHEME_THREAD_SANITIZER_STOP"); initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER"); initProp("XCODE_SCHEME_UNDEFINED_BEHAVIOUR_SANITIZER_STOP"); + initProp("XCODE_SCHEME_LAUNCH_CONFIGURATION"); initProp("XCODE_SCHEME_ENABLE_GPU_API_VALIDATION"); initProp("XCODE_SCHEME_ENABLE_GPU_SHADER_VALIDATION"); initProp("XCODE_SCHEME_WORKING_DIRECTORY"); diff --git a/Source/cmXCodeScheme.cxx b/Source/cmXCodeScheme.cxx index 1c609f3..e727d22 100644 --- a/Source/cmXCodeScheme.cxx +++ b/Source/cmXCodeScheme.cxx @@ -67,9 +67,14 @@ void cmXCodeScheme::WriteXCodeXCScheme(std::ostream& fout, xout.Attribute("LastUpgradeVersion", WriteVersionString()); xout.Attribute("version", "1.3"); + cmValue propDftCfg = + Target->GetTarget()->GetProperty("XCODE_SCHEME_LAUNCH_CONFIGURATION"); + std::string launchConfiguration = + !propDftCfg.IsEmpty() ? *propDftCfg : "Debug"; + WriteBuildAction(xout, container); WriteTestAction(xout, FindConfiguration("Debug"), container); - WriteLaunchAction(xout, FindConfiguration("Debug"), container); + WriteLaunchAction(xout, FindConfiguration(launchConfiguration), container); WriteProfileAction(xout, FindConfiguration("Release")); WriteAnalyzeAction(xout, FindConfiguration("Debug")); WriteArchiveAction(xout, FindConfiguration("Release")); -- cgit v0.12