summaryrefslogtreecommitdiff
path: root/Tests/OutOfBinary
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-09-25 13:26:44 -0400
committerBrad King <brad.king@kitware.com>2015-09-25 14:36:30 -0400
commit6e2a4087f2ff93fcea8391963a4101fce52ee94d (patch)
tree29b04b188382fcc8411b799e2d788e83c8f78ee0 /Tests/OutOfBinary
parent993d064197b36de9e18131afc4ace753b8570d0b (diff)
downloadcmake-6e2a4087f2ff93fcea8391963a4101fce52ee94d.tar.gz
Ninja: Centralize path conversion in global generator (#15757)
In the Ninja generator we run all build rules from the top of the build tree rather than changing into each subdirectory. Therefore we convert all paths relative to the HOME_OUTPUT directory. However, the Convert method on cmLocalGenerator restricts relative path conversions to avoid leaving the build tree with a "../" sequence. Therefore conversions performed for "subdirectories" that are outside the top of the build tree always use full paths while conversions performed for subdirectories that are inside the top of the build tree may use relative paths to refer to the same files. Since Ninja always runs rules from the top of the build tree we should convert them using only the top-level cmLocalGenerator in order to remain consistent. Also extend the test suite with a case that fails without this fix.
Diffstat (limited to 'Tests/OutOfBinary')
-rw-r--r--Tests/OutOfBinary/CMakeLists.txt2
-rw-r--r--Tests/OutOfBinary/outexe.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/Tests/OutOfBinary/CMakeLists.txt b/Tests/OutOfBinary/CMakeLists.txt
index e327541436..f50536e704 100644
--- a/Tests/OutOfBinary/CMakeLists.txt
+++ b/Tests/OutOfBinary/CMakeLists.txt
@@ -1,2 +1,4 @@
add_library(outlib outlib.c)
+add_executable(outexe outexe.c)
+target_link_libraries(outexe subdir)
diff --git a/Tests/OutOfBinary/outexe.c b/Tests/OutOfBinary/outexe.c
new file mode 100644
index 0000000000..6f14043589
--- /dev/null
+++ b/Tests/OutOfBinary/outexe.c
@@ -0,0 +1,2 @@
+extern int subdir(void);
+int main(void) { return subdir(); }