summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorFrank Benkstein <frank@benkstein.net>2018-11-09 18:14:58 (GMT)
committerBrad King <brad.king@kitware.com>2018-11-19 15:11:12 (GMT)
commit57701227d68d7add76c119a570adf654af03de95 (patch)
tree0a94260ddd56cb57c66a9291b7578f4f64bba547 /Source
parent8d70ed5a10362209d265a15d993f319235aea7e5 (diff)
downloadCMake-57701227d68d7add76c119a570adf654af03de95.zip
CMake-57701227d68d7add76c119a570adf654af03de95.tar.gz
CMake-57701227d68d7add76c119a570adf654af03de95.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')
-rw-r--r--Source/cmConfigureFileCommand.cxx14
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)) {