summaryrefslogtreecommitdiffstats
path: root/Source/cmGeneratorExpressionEvaluationFile.cxx
diff options
context:
space:
mode:
authorAsit Dhal <dhal.asitk@gmail.com>2020-10-28 10:07:57 (GMT)
committerAsit Dhal <dhal.asitk@gmail.com>2020-12-21 11:16:16 (GMT)
commitc3385dd8bd7c78cf03d7e52ae0f49e8216cdaaea (patch)
tree429c6d6e88db90402670eef5e288f7f4a1bb29ca /Source/cmGeneratorExpressionEvaluationFile.cxx
parentc89514a6a47b678dddb703c302def4fe56abe275 (diff)
downloadCMake-c3385dd8bd7c78cf03d7e52ae0f49e8216cdaaea.zip
CMake-c3385dd8bd7c78cf03d7e52ae0f49e8216cdaaea.tar.gz
CMake-c3385dd8bd7c78cf03d7e52ae0f49e8216cdaaea.tar.bz2
file(GENERATE): Support options to manipulate file permissions
Fixes: #15653
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluationFile.cxx')
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx12
1 files changed, 8 insertions, 4 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index 3c17b54..af129d3 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -21,13 +21,15 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
std::string input, std::string target,
std::unique_ptr<cmCompiledGeneratorExpression> outputFileExpr,
std::unique_ptr<cmCompiledGeneratorExpression> condition,
- bool inputIsContent, cmPolicies::PolicyStatus policyStatusCMP0070)
+ bool inputIsContent, mode_t permissions,
+ cmPolicies::PolicyStatus policyStatusCMP0070)
: Input(std::move(input))
, Target(std::move(target))
, OutputFileExpr(std::move(outputFileExpr))
, Condition(std::move(condition))
, InputIsContent(inputIsContent)
, PolicyStatusCMP0070(policyStatusCMP0070)
+ , Permissions(permissions)
{
}
@@ -111,14 +113,15 @@ void cmGeneratorExpressionEvaluationFile::CreateOutputFile(
void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
{
- mode_t perm = 0;
std::string inputContent;
if (this->InputIsContent) {
inputContent = this->Input;
} else {
const std::string inputFileName = this->GetInputFileName(lg);
lg->GetMakefile()->AddCMakeDependFile(inputFileName);
- cmSystemTools::GetPermissions(inputFileName.c_str(), perm);
+ if (!this->Permissions) {
+ cmSystemTools::GetPermissions(inputFileName.c_str(), this->Permissions);
+ }
cmsys::ifstream fin(inputFileName.c_str());
if (!fin) {
std::ostringstream e;
@@ -152,7 +155,8 @@ void cmGeneratorExpressionEvaluationFile::Generate(cmLocalGenerator* lg)
for (std::string const& le : enabledLanguages) {
for (std::string const& li : allConfigs) {
- this->Generate(lg, li, le, inputExpression.get(), outputFiles, perm);
+ this->Generate(lg, li, le, inputExpression.get(), outputFiles,
+ this->Permissions);
if (cmSystemTools::GetFatalErrorOccured()) {
return;
}