mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-02 11:49:55 -06:00
file(GENERATE): Refactor inputFileName calculation
This commit is contained in:
committed by
Brad King
parent
31b057182e
commit
a9602bb41e
@@ -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)
|
||||
{
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user