mirror of
https://github.com/Kitware/CMake.git
synced 2025-10-14 19:08:07 +08:00
Xcode: Use DEBUGGER_WORKING_DIRECTORY as a fallback for scheme work dir
This also means when XCODE_SCHEME_WORKING_DIRECTORY is set and a Xcode generator is used, that property will be used when writing the debugger field in the file API replies. Fixes: #26909
This commit is contained in:
@@ -13,3 +13,6 @@ created.
|
||||
If the :prop_tgt:`VS_DEBUGGER_WORKING_DIRECTORY` property is also set, it will
|
||||
take precedence over ``DEBUGGER_WORKING_DIRECTORY`` when using one of the
|
||||
Visual Studio generators.
|
||||
|
||||
Similarly, if :prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` is set, it will
|
||||
override ``DEBUGGER_WORKING_DIRECTORY`` when using the Xcode generator.
|
||||
|
@@ -13,3 +13,5 @@ when a target is created.
|
||||
|
||||
Please refer to the :prop_tgt:`XCODE_GENERATE_SCHEME` target property
|
||||
documentation to see all Xcode schema related properties.
|
||||
|
||||
See also :prop_tgt:`DEBUGGER_WORKING_DIRECTORY`.
|
||||
|
@@ -289,3 +289,7 @@ Changes made since CMake 4.0.0 include the following.
|
||||
This restores support for using LLVM/Clang on macOS without manually
|
||||
setting ``CMAKE_OSX_SYSROOT``, which was broken by CMake 4.0.0's
|
||||
removal of a default value.
|
||||
|
||||
* The :prop_tgt:`DEBUGGER_WORKING_DIRECTORY` target property is now
|
||||
used by the :generator:`Xcode` generator as a fallback for the
|
||||
:prop_tgt:`XCODE_SCHEME_WORKING_DIRECTORY` target property.
|
||||
|
@@ -5387,3 +5387,12 @@ std::string cmGlobalXCodeGenerator::GetDeploymentPlatform(cmMakefile const* mf)
|
||||
return "MACOSX_DEPLOYMENT_TARGET";
|
||||
}
|
||||
}
|
||||
|
||||
cmValue cmGlobalXCodeGenerator::GetDebuggerWorkingDirectory(
|
||||
cmGeneratorTarget* gt) const
|
||||
{
|
||||
if (cmValue ret = gt->GetProperty("XCODE_SCHEME_WORKING_DIRECTORY")) {
|
||||
return ret;
|
||||
}
|
||||
return cmGlobalGenerator::GetDebuggerWorkingDirectory(gt);
|
||||
}
|
||||
|
@@ -132,6 +132,8 @@ public:
|
||||
cmMakefile* mf) override;
|
||||
void AppendFlag(std::string& flags, std::string const& flag) const;
|
||||
|
||||
cmValue GetDebuggerWorkingDirectory(cmGeneratorTarget* gt) const override;
|
||||
|
||||
enum class BuildSystem
|
||||
{
|
||||
One = 1,
|
||||
|
@@ -14,6 +14,7 @@
|
||||
#include "cmGeneratedFileStream.h"
|
||||
#include "cmGeneratorExpression.h"
|
||||
#include "cmGeneratorTarget.h"
|
||||
#include "cmGlobalGenerator.h"
|
||||
#include "cmList.h"
|
||||
#include "cmStateTypes.h"
|
||||
#include "cmStringAlgorithms.h"
|
||||
@@ -474,16 +475,17 @@ void cmXCodeScheme::WriteBuildableReference(cmXMLWriter& xout,
|
||||
void cmXCodeScheme::WriteCustomWorkingDirectory(
|
||||
cmXMLWriter& xout, std::string const& configuration)
|
||||
{
|
||||
std::string const& propertyValue =
|
||||
this->Target->GetTarget()->GetSafeProperty(
|
||||
"XCODE_SCHEME_WORKING_DIRECTORY");
|
||||
if (propertyValue.empty()) {
|
||||
cmGlobalGenerator* gg = this->LocalGenerator->GetGlobalGenerator();
|
||||
|
||||
cmValue propertyValue =
|
||||
gg->GetDebuggerWorkingDirectory(this->Target->GetTarget());
|
||||
if (!propertyValue) {
|
||||
xout.Attribute("useCustomWorkingDirectory", "NO");
|
||||
} else {
|
||||
xout.Attribute("useCustomWorkingDirectory", "YES");
|
||||
|
||||
auto customWorkingDirectory = cmGeneratorExpression::Evaluate(
|
||||
propertyValue, this->LocalGenerator, configuration);
|
||||
*propertyValue, this->LocalGenerator, configuration);
|
||||
xout.Attribute("customWorkingDirectory", customWorkingDirectory);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user