diff options
author | Brad King <brad.king@kitware.com> | 2022-02-25 13:35:46 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2022-02-28 15:26:04 (GMT) |
commit | d33b12d84b59fd3310c31de7d9c3f83b28b681e2 (patch) | |
tree | 4a43c7f6e68f1f8770b42288799ecb2433ade03c /Tests | |
parent | 43416c48ed6bb7d3b8063ac4ea1ba02a4aab828e (diff) | |
download | CMake-d33b12d84b59fd3310c31de7d9c3f83b28b681e2.zip CMake-d33b12d84b59fd3310c31de7d9c3f83b28b681e2.tar.gz CMake-d33b12d84b59fd3310c31de7d9c3f83b28b681e2.tar.bz2 |
Add support for build tree symlink inside source tree
Since commit c564a3e3ff (Ninja: Always compile sources using absolute
paths, 2021-05-19, v3.21.0-rc1~129^2), both the Ninja and Makefile
generators pass source files and include directories to the compiler as
absolute paths. However, in some other contexts within generated build
systems, we generate paths that may be relative or absolute. In these
contexts, we prefer relative paths, but avoid them when they contain a
`../` sequence that leaves both the build tree and the source tree:
* When the build tree is outside of the source tree, all paths to the
source tree are absolute.
* When the build tree is inside the source tree, we previously assumed
that it is a real directory such that exiting the build tree with
`../` enters the source tree. This allowed paths to the source
tree to be relative to the build tree.
In the latter case, we previously did not support using a symbolic link
inside the source tree to point at the build tree. This is because
relative paths to the source tree would be generated with `../`
sequences leaving the build tree, but they would jump to the parent of
the real build tree, which is not the source tree.
Fix this by requiring that `../` sequences stay inside the build tree
even if its path appears to be inside the source tree. When the build
tree is inside the source tree, all paths to the source tree are now
absolute. For consistency, this applies regardless of whether the
path to the build tree contains a symbolic link.
Fixes: #21819
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake index 3f3aafe..e5bfac4 100644 --- a/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake +++ b/Tests/RunCMake/SymlinkTrees/RunCMakeTest.cmake @@ -76,12 +76,6 @@ function (run_symlink_test case src bin src_from_bin bin_from_src) run_symlink_test_case("${case}" -S "../${name}/${src}" -B "../${name}/${bin}") # Verify paths passed to compiler. - if(case MATCHES "^(different|asymmetric)-bin_in_src$") - # FIXME: Some generators compute incorrect relative paths. - 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") |