diff options
author | Stephen Kelly <steveire@gmail.com> | 2014-07-22 13:10:57 (GMT) |
---|---|---|
committer | Stephen Kelly <steveire@gmail.com> | 2014-11-04 21:38:22 (GMT) |
commit | 81afbbc09bac6913e2b83f7eb68923ff5b1911d5 (patch) | |
tree | 5ef96145b947affec91a86ae6d009e5a7d03929c /Source | |
parent | db3cfc3376f2021f7c80ba220ecada64832b5ee1 (diff) | |
download | CMake-81afbbc09bac6913e2b83f7eb68923ff5b1911d5.zip CMake-81afbbc09bac6913e2b83f7eb68923ff5b1911d5.tar.gz CMake-81afbbc09bac6913e2b83f7eb68923ff5b1911d5.tar.bz2 |
file(GENERATE): Use permissions of input file if present.
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.cxx | 10 | ||||
-rw-r--r-- | Source/cmGeneratorExpressionEvaluationFile.h | 2 |
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; |