diff options
author | Josef Angstenberger <code@jtxa.de> | 2020-08-01 00:58:44 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2020-08-19 13:03:36 (GMT) |
commit | 2dc2732f679d160ea954bf8903e5b7626096a2e8 (patch) | |
tree | 4c4ec78b40e0ebe01f6a95986d716487019f1093 /Source/cmGeneratorExpressionEvaluationFile.cxx | |
parent | a9602bb41e562ae48332e5fd54577868e9d23e06 (diff) | |
download | CMake-2dc2732f679d160ea954bf8903e5b7626096a2e8.zip CMake-2dc2732f679d160ea954bf8903e5b7626096a2e8.tar.gz CMake-2dc2732f679d160ea954bf8903e5b7626096a2e8.tar.bz2 |
file(GENERATE): Refactor outputFileName calculation
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluationFile.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.cxx | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index e421c51..667b4e6 100644 --- a/Source/cmGeneratorExpressionEvaluationFile.cxx +++ b/Source/cmGeneratorExpressionEvaluationFile.cxx @@ -54,17 +54,10 @@ void cmGeneratorExpressionEvaluationFile::Generate( } } - std::string outputFileName = this->OutputFileExpr->Evaluate( - lg, config, nullptr, nullptr, nullptr, lang); + const std::string outputFileName = this->GetOutputFileName(lg, config, lang); const std::string& outputContent = inputExpression->Evaluate(lg, config, nullptr, nullptr, nullptr, lang); - if (cmSystemTools::FileIsFullPath(outputFileName)) { - outputFileName = cmSystemTools::CollapseFullPath(outputFileName); - } else { - outputFileName = this->FixRelativePath(outputFileName, PathForOutput, lg); - } - auto it = outputFiles.find(outputFileName); if (it != outputFiles.end()) { @@ -183,6 +176,21 @@ std::string cmGeneratorExpressionEvaluationFile::GetInputFileName( return inputFileName; } +std::string cmGeneratorExpressionEvaluationFile::GetOutputFileName( + cmLocalGenerator* lg, const std::string& config, const std::string& lang) +{ + std::string outputFileName = this->OutputFileExpr->Evaluate( + lg, config, nullptr, nullptr, nullptr, lang); + + if (cmSystemTools::FileIsFullPath(outputFileName)) { + outputFileName = cmSystemTools::CollapseFullPath(outputFileName); + } else { + outputFileName = this->FixRelativePath(outputFileName, PathForOutput, lg); + } + + return outputFileName; +} + std::string cmGeneratorExpressionEvaluationFile::FixRelativePath( std::string const& relativePath, PathRole role, cmLocalGenerator* lg) { |