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 /Source/cmConfigureFileCommand.cxx | |
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 'Source/cmConfigureFileCommand.cxx')
-rw-r--r-- | Source/cmConfigureFileCommand.cxx | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/Source/cmConfigureFileCommand.cxx b/Source/cmConfigureFileCommand.cxx index b5a639a..305262d 100644 --- a/Source/cmConfigureFileCommand.cxx +++ b/Source/cmConfigureFileCommand.cxx @@ -20,11 +20,8 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args, } std::string const& inFile = args[0]; - if (!cmSystemTools::FileIsFullPath(inFile)) { - this->InputFile = this->Makefile->GetCurrentSourceDirectory(); - this->InputFile += "/"; - } - this->InputFile += inFile; + this->InputFile = cmSystemTools::CollapseFullPath( + inFile, this->Makefile->GetCurrentSourceDirectory()); // If the input location is a directory, error out. if (cmSystemTools::FileIsDirectory(this->InputFile)) { @@ -39,11 +36,8 @@ bool cmConfigureFileCommand::InitialPass(std::vector<std::string> const& args, } std::string const& outFile = args[1]; - if (!cmSystemTools::FileIsFullPath(outFile)) { - this->OutputFile = this->Makefile->GetCurrentBinaryDirectory(); - this->OutputFile += "/"; - } - this->OutputFile += outFile; + this->OutputFile = cmSystemTools::CollapseFullPath( + outFile, this->Makefile->GetCurrentBinaryDirectory()); // If the output location is already a directory put the file in it. if (cmSystemTools::FileIsDirectory(this->OutputFile)) { |