mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-05 13:20:47 -06:00
Xcode: Fix support for source tree symlink inside build tree
Since commit 61495cdaae (Fix Xcode project references to the source
tree, 2009-09-22, v2.8.0~43) we force source file references to use
relative paths from the source tree. If the source tree path is a
symbolic link inside the build tree, the relative `../` sequence
goes to the wrong place. The problem with debug breakpoints motivating
that change does not seem to occur in modern Xcode versions, so update
the logic to use a relative path only when it does not need to start
in any `../` sequence.
This commit is contained in:
@@ -4695,10 +4695,12 @@ std::string cmGlobalXCodeGenerator::ConvertToRelativeForMake(
|
||||
|
||||
std::string cmGlobalXCodeGenerator::RelativeToSource(const std::string& p)
|
||||
{
|
||||
// We force conversion because Xcode breakpoints do not work unless
|
||||
// they are in a file named relative to the source tree.
|
||||
return cmSystemTools::ForceToRelativePath(
|
||||
this->CurrentRootGenerator->GetCurrentSourceDirectory(), p);
|
||||
std::string const& rootSrc =
|
||||
this->CurrentRootGenerator->GetCurrentSourceDirectory();
|
||||
if (cmSystemTools::IsSubDirectory(p, rootSrc)) {
|
||||
return cmSystemTools::ForceToRelativePath(rootSrc, p);
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
std::string cmGlobalXCodeGenerator::RelativeToBinary(const std::string& p)
|
||||
|
||||
@@ -82,12 +82,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src)
|
||||
message(STATUS "${case}-exe-build - SKIPPED")
|
||||
return()
|
||||
endif()
|
||||
if(case MATCHES "^(different|asymmetric)-src_in_bin$" AND RunCMake_GENERATOR STREQUAL "Xcode")
|
||||
# FIXME: The Xcode generator computes an incorrect relative path.
|
||||
message(STATUS "${case}-exe - SKIPPED")
|
||||
message(STATUS "${case}-exe-build - SKIPPED")
|
||||
return()
|
||||
endif()
|
||||
unset(RunCMake_TEST_VARIANT_DESCRIPTION)
|
||||
run_symlink_test_case("${case}-exe" -S "${src}" -B "${bin}")
|
||||
if (RunCMake_GENERATOR MATCHES "Xcode")
|
||||
|
||||
Reference in New Issue
Block a user