diff options
author | Frank Benkstein <frank@benkstein.net> | 2018-11-09 18:14:58 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2018-11-13 20:01:17 (GMT) |
commit | 6199637e9540627b03d9018ff53a14f005274607 (patch) | |
tree | 1f4fa728d2a86b0617bb6894bd69d794c075cecd /Tests/RunCMake/Ninja | |
parent | 48bc74710d4ddcf62e3dcf69e3400e4060a2bdc1 (diff) | |
download | CMake-6199637e9540627b03d9018ff53a14f005274607.zip CMake-6199637e9540627b03d9018ff53a14f005274607.tar.gz CMake-6199637e9540627b03d9018ff53a14f005274607.tar.bz2 |
configure_file: canonicalize input and output path in dependencies
Represent the input file path internally in canonical form. Otherwise
multiple `configure_file` calls that share the same input file but specify
it relative to different directories (e.g. via `../`) result in multiple
copies of the dependency on the rule to re-run CMake. This causes the
Ninja generator to emit duplicate phony build statements for these
dependencies, which generates an error with `-w dupbuild=err`, which
will be default in Ninja 1.9.
Also canonicalize the output path for consistency.
Add a test case.
Fixes: #18584
Diffstat (limited to 'Tests/RunCMake/Ninja')
-rw-r--r-- | Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake | 5 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/RunCMakeTest.cmake | 7 | ||||
-rw-r--r-- | Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt | 1 |
3 files changed, 13 insertions, 0 deletions
diff --git a/Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake b/Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake new file mode 100644 index 0000000..505f750 --- /dev/null +++ b/Tests/RunCMake/Ninja/PreventConfigureFileDupBuildRule.cmake @@ -0,0 +1,5 @@ +cmake_minimum_required(VERSION 3.12) +project(Test LANGUAGES C) + +configure_file(PreventConfigureFileDupBuildRule.cmake PreventTargetAliasesDupBuildRule.cmake @ONLY) +add_subdirectory(SubDirConfigureFileDup) diff --git a/Tests/RunCMake/Ninja/RunCMakeTest.cmake b/Tests/RunCMake/Ninja/RunCMakeTest.cmake index 4b366a8..9e1e9a5 100644 --- a/Tests/RunCMake/Ninja/RunCMakeTest.cmake +++ b/Tests/RunCMake/Ninja/RunCMakeTest.cmake @@ -286,3 +286,10 @@ function (run_PreventTargetAliasesDupBuildRule) run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) endfunction () run_PreventTargetAliasesDupBuildRule() + +function (run_PreventConfigureFileDupBuildRule) + set(RunCMake_TEST_BINARY_DIR ${RunCMake_BINARY_DIR}/PreventConfigureFileDupBuildRule-build) + run_cmake(PreventConfigureFileDupBuildRule) + run_ninja("${RunCMake_TEST_BINARY_DIR}" -w dupbuild=err) +endfunction() +run_PreventConfigureFileDupBuildRule() diff --git a/Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt b/Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt new file mode 100644 index 0000000..433f77b --- /dev/null +++ b/Tests/RunCMake/Ninja/SubDirConfigureFileDup/CMakeLists.txt @@ -0,0 +1 @@ +configure_file(../PreventConfigureFileDupBuildRule.cmake PreventTargetAliasesDupBuildRule.cmake @ONLY) |