mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 21:59:54 -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) {
|
if (this->InputIsContent) {
|
||||||
inputContent = this->Input;
|
inputContent = this->Input;
|
||||||
} else {
|
} else {
|
||||||
std::string inputFileName = this->Input;
|
const std::string inputFileName = this->GetInputFileName(lg);
|
||||||
if (cmSystemTools::FileIsFullPath(inputFileName)) {
|
|
||||||
inputFileName = cmSystemTools::CollapseFullPath(inputFileName);
|
|
||||||
} else {
|
|
||||||
inputFileName = this->FixRelativePath(inputFileName, PathForInput, lg);
|
|
||||||
}
|
|
||||||
lg->GetMakefile()->AddCMakeDependFile(inputFileName);
|
lg->GetMakefile()->AddCMakeDependFile(inputFileName);
|
||||||
cmSystemTools::GetPermissions(inputFileName.c_str(), perm);
|
cmSystemTools::GetPermissions(inputFileName.c_str(), perm);
|
||||||
cmsys::ifstream fin(inputFileName.c_str());
|
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 cmGeneratorExpressionEvaluationFile::FixRelativePath(
|
||||||
std::string const& relativePath, PathRole role, cmLocalGenerator* lg)
|
std::string const& relativePath, PathRole role, cmLocalGenerator* lg)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -38,6 +38,7 @@ private:
|
|||||||
cmCompiledGeneratorExpression* inputExpression,
|
cmCompiledGeneratorExpression* inputExpression,
|
||||||
std::map<std::string, std::string>& outputFiles, mode_t perm);
|
std::map<std::string, std::string>& outputFiles, mode_t perm);
|
||||||
|
|
||||||
|
std::string GetInputFileName(cmLocalGenerator* lg);
|
||||||
enum PathRole
|
enum PathRole
|
||||||
{
|
{
|
||||||
PathForInput,
|
PathForInput,
|
||||||
|
|||||||
Reference in New Issue
Block a user