summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Angstenberger <code@jtxa.de>2020-08-01 00:58:44 (GMT)
committerBrad King <brad.king@kitware.com>2020-08-19 13:03:36 (GMT)
commit2dc2732f679d160ea954bf8903e5b7626096a2e8 (patch)
tree4c4ec78b40e0ebe01f6a95986d716487019f1093
parenta9602bb41e562ae48332e5fd54577868e9d23e06 (diff)
downloadCMake-2dc2732f679d160ea954bf8903e5b7626096a2e8.zip
CMake-2dc2732f679d160ea954bf8903e5b7626096a2e8.tar.gz
CMake-2dc2732f679d160ea954bf8903e5b7626096a2e8.tar.bz2
file(GENERATE): Refactor outputFileName calculation
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx24
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h3
2 files changed, 19 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)
{
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index eb1e03d..a258a2d 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -39,6 +39,9 @@ private:
std::map<std::string, std::string>& outputFiles, mode_t perm);
std::string GetInputFileName(cmLocalGenerator* lg);
+ std::string GetOutputFileName(cmLocalGenerator* lg,
+ const std::string& config,
+ const std::string& lang);
enum PathRole
{
PathForInput,