diff options
author | Brad King <brad.king@kitware.com> | 2014-11-10 15:43:04 (GMT) |
---|---|---|
committer | CMake Topic Stage <kwrobot@kitware.com> | 2014-11-10 15:43:04 (GMT) |
commit | 8532a4f9a061883dea639b2f7942c93a6682bc49 (patch) | |
tree | 926b93ec359190084576df7bd1f84d099fc96fa2 /Source | |
parent | 6431cc641bf42551ef6b5d7019fe857909d593fc (diff) | |
parent | 81afbbc09bac6913e2b83f7eb68923ff5b1911d5 (diff) | |
download | CMake-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.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; |