diff options
author | Sebastian Holtermann <sebholt@xwmw.org> | 2016-11-30 12:04:52 (GMT) |
---|---|---|
committer | Sebastian Holtermann <sebholt@xwmw.org> | 2016-12-06 14:59:26 (GMT) |
commit | 4fa858ecb1b40e63c733047f07cc5049f7e2366a (patch) | |
tree | c514b053e1aa16317ffb81fffb2fc7e08dbc496d /Source/cmQtAutoGeneratorInitializer.cxx | |
parent | 273e481e48c855905bde4d91a986c06713df0183 (diff) | |
download | CMake-4fa858ecb1b40e63c733047f07cc5049f7e2366a.zip CMake-4fa858ecb1b40e63c733047f07cc5049f7e2366a.tar.gz CMake-4fa858ecb1b40e63c733047f07cc5049f7e2366a.tar.bz2 |
QtAutogen: Change config file permissions only on demand
Diffstat (limited to 'Source/cmQtAutoGeneratorInitializer.cxx')
-rw-r--r-- | Source/cmQtAutoGeneratorInitializer.cxx | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/Source/cmQtAutoGeneratorInitializer.cxx b/Source/cmQtAutoGeneratorInitializer.cxx index 576b2eb..384c336 100644 --- a/Source/cmQtAutoGeneratorInitializer.cxx +++ b/Source/cmQtAutoGeneratorInitializer.cxx @@ -888,26 +888,31 @@ void cmQtAutoGeneratorInitializer::SetupAutoGenerateTarget( RccSetupAutoTarget(target); } + // Generate config file std::string inputFile = cmSystemTools::GetCMakeRoot(); inputFile += "/Modules/AutogenInfo.cmake.in"; std::string outputFile = GetAutogenTargetFilesDir(target); outputFile += "/AutogenInfo.cmake"; + makefile->ConfigureFile(inputFile.c_str(), outputFile.c_str(), false, true, false); - // Ensure we have write permission in case .in was read-only. - mode_t perm = 0; + // Append custom definitions to config file + if (!configMocDefines.empty() || !configMocIncludes.empty() || + !configUicOptions.empty()) { + + // Ensure we have write permission in case .in was read-only. + mode_t perm = 0; #if defined(_WIN32) && !defined(__CYGWIN__) - mode_t mode_write = S_IWRITE; + mode_t mode_write = S_IWRITE; #else - mode_t mode_write = S_IWUSR; + mode_t mode_write = S_IWUSR; #endif - cmSystemTools::GetPermissions(outputFile, perm); - if (!(perm & mode_write)) { - cmSystemTools::SetPermissions(outputFile, perm | mode_write); - } - if (!configMocDefines.empty() || !configMocIncludes.empty() || - !configUicOptions.empty()) { + cmSystemTools::GetPermissions(outputFile, perm); + if (!(perm & mode_write)) { + cmSystemTools::SetPermissions(outputFile, perm | mode_write); + } + cmsys::ofstream infoFile(outputFile.c_str(), std::ios::app); if (!infoFile) { std::string error = "Internal CMake error when trying to open file: "; |