summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Angstenberger <code@jtxa.de>2020-08-01 00:58:26 (GMT)
committerBrad King <brad.king@kitware.com>2020-08-19 13:03:36 (GMT)
commita9602bb41e562ae48332e5fd54577868e9d23e06 (patch)
treeab7f44aceb3749828eab1fefaf283dccf24bd78d
parent31b057182e75130dc3fb77f0bf1fe0d0abb1a60c (diff)
downloadCMake-a9602bb41e562ae48332e5fd54577868e9d23e06.zip
CMake-a9602bb41e562ae48332e5fd54577868e9d23e06.tar.gz
CMake-a9602bb41e562ae48332e5fd54577868e9d23e06.tar.bz2
file(GENERATE): Refactor inputFileName calculation
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx21
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h1
2 files changed, 16 insertions, 6 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 1107adb..e421c51 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -125,12 +125,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 +169,20 @@ 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::FixRelativePath(
std::string const& relativePath, PathRole role, cmLocalGenerator* lg)
{
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index c3bc4c8..eb1e03d 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -38,6 +38,7 @@ private:
cmCompiledGeneratorExpression* inputExpression,
std::map<std::string, std::string>& outputFiles, mode_t perm);
+ std::string GetInputFileName(cmLocalGenerator* lg);
enum PathRole
{
PathForInput,