summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2014-11-10 15:43:04 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2014-11-10 15:43:04 (GMT)
commit8532a4f9a061883dea639b2f7942c93a6682bc49 (patch)
tree926b93ec359190084576df7bd1f84d099fc96fa2 /Source
parent6431cc641bf42551ef6b5d7019fe857909d593fc (diff)
parent81afbbc09bac6913e2b83f7eb68923ff5b1911d5 (diff)
downloadCMake-8532a4f9a061883dea639b2f7942c93a6682bc49.zip
CMake-8532a4f9a061883dea639b2f7942c93a6682bc49.tar.gz
CMake-8532a4f9a061883dea639b2f7942c93a6682bc49.tar.bz2
Merge topic 'file-GENERATE-permissions'
81afbbc0 file(GENERATE): Use permissions of input file if present.
Diffstat (limited to 'Source')
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.cxx10
-rw-r--r--Source/cmGeneratorExpressionEvaluationFile.h2
2 files changed, 9 insertions, 3 deletions
diff --git a/Source/cmGeneratorExpressionEvaluationFile.cxx b/Source/cmGeneratorExpressionEvaluationFile.cxx
index f9067cf..3a8dc48 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.cxx
+++ b/Source/cmGeneratorExpressionEvaluationFile.cxx
@@ -36,7 +36,7 @@ cmGeneratorExpressionEvaluationFile::cmGeneratorExpressionEvaluationFile(
//----------------------------------------------------------------------------
void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
cmCompiledGeneratorExpression* inputExpression,
- std::map<std::string, std::string> &outputFiles)
+ std::map<std::string, std::string> &outputFiles, mode_t perm)
{
std::string rawCondition = this->Condition->GetInput();
if (!rawCondition.empty())
@@ -83,11 +83,16 @@ void cmGeneratorExpressionEvaluationFile::Generate(const std::string& config,
cmGeneratedFileStream fout(outputFileName.c_str());
fout.SetCopyIfDifferent(true);
fout << outputContent;
+ if (fout.Close() && perm)
+ {
+ cmSystemTools::SetPermissions(outputFileName.c_str(), perm);
+ }
}
//----------------------------------------------------------------------------
void cmGeneratorExpressionEvaluationFile::Generate()
{
+ mode_t perm = 0;
std::string inputContent;
if (this->InputIsContent)
{
@@ -95,6 +100,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
}
else
{
+ cmSystemTools::GetPermissions(this->Input.c_str(), perm);
cmsys::ifstream fin(this->Input.c_str());
if(!fin)
{
@@ -131,7 +137,7 @@ void cmGeneratorExpressionEvaluationFile::Generate()
for(std::vector<std::string>::const_iterator li = allConfigs.begin();
li != allConfigs.end(); ++li)
{
- this->Generate(*li, inputExpression.get(), outputFiles);
+ this->Generate(*li, inputExpression.get(), outputFiles, perm);
if(cmSystemTools::GetFatalErrorOccured())
{
return;
diff --git a/Source/cmGeneratorExpressionEvaluationFile.h b/Source/cmGeneratorExpressionEvaluationFile.h
index f939916..4e87a88 100644
--- a/Source/cmGeneratorExpressionEvaluationFile.h
+++ b/Source/cmGeneratorExpressionEvaluationFile.h
@@ -34,7 +34,7 @@ public:
private:
void Generate(const std::string& config,
cmCompiledGeneratorExpression* inputExpression,
- std::map<std::string, std::string> &outputFiles);
+ std::map<std::string, std::string> &outputFiles, mode_t perm);
private:
const std::string Input;