diff options
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluationFile.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.cxx | 48 |
1 files changed, 32 insertions, 16 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx index 1107adb..6647e62 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()) { @@ -101,8 +94,7 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile( gg->GetEnabledLanguages(enabledLanguages); for (std::string const& le : enabledLanguages) { - std::string name = this->OutputFileExpr->Evaluate(lg, config, nullptr, - nullptr, nullptr, le); + std::string const name = this->GetOutputFileName(lg, config, le); cmSourceFile* sf = lg->GetMakefile()->GetOrCreateSource( name, false, cmSourceFileLocationKind::Known); // Tell TraceDependencies that the file is not expected to exist @@ -125,12 +117,7 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg) if (this->InputIsContent) { inputContent = this->Input; } else { - std::string inputFileName = this->Input; - if (cmSystemTools::FileIsFullPath(inputFileName)) { - inputFileName = cmSystemTools::CollapseFullPath(inputFileName); - } else { - inputFileName = this->FixRelativePath(inputFileName, PathForInput, lg); - } + const std::string inputFileName = this->GetInputFileName(lg); lg->GetMakefile()->AddCMakeDependFile(inputFileName); cmSystemTools::GetPermissions(inputFileName.c_str(), perm); cmsys::ifstream fin(inputFileName.c_str()); @@ -174,6 +161,35 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg) } } +std::string cmGeneratorExpressionEvaluationFile::GetInputFileName( + cmLocalGenerator* lg) +{ + std::string inputFileName = this->Input; + + if (cmSystemTools::FileIsFullPath(inputFileName)) { + inputFileName = cmSystemTools::CollapseFullPath(inputFileName); + } else { + inputFileName = this->FixRelativePath(inputFileName, PathForInput, lg); + } + + 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) { |