diff options
author | Justin Borodinsky <justin.borodinsky@gmail.com> | 2015-03-19 01:30:26 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2015-03-20 14:33:52 (GMT) |
commit | 610464c12e0ef71b2bea28973b70630c4ce9a70e (patch) | |
tree | 3f2b717d66d36fb2cf6b2fb57bb73573fbe49747 /Source/cmQtAutoGenerators.cxx | |
parent | c95e523db87cd503c97ca2a6021614393bb33e0b (diff) | |
download | CMake-610464c12e0ef71b2bea28973b70630c4ce9a70e.zip CMake-610464c12e0ef71b2bea28973b70630c4ce9a70e.tar.gz CMake-610464c12e0ef71b2bea28973b70630c4ce9a70e.tar.bz2 |
QtAutogen: Ensure write access to AutogenInfo.cmake (#15416)
ConfigureFile uses the input file permissions, but we require write
access in cmQtAutoGenerators::SetupAutoGenerateTarget to append to the
file.
Diffstat (limited to 'Source/cmQtAutoGenerators.cxx')
-rw-r--r-- | Source/cmQtAutoGenerators.cxx | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx index 42c18f7..08092c7 100644 --- a/Source/cmQtAutoGenerators.cxx +++ b/Source/cmQtAutoGenerators.cxx @@ -22,6 +22,8 @@ # include "cmLocalVisualStudioGenerator.h" #endif +#include <sys/stat.h> + #include <cmsys/Terminal.h> #include <cmsys/ios/sstream> #include <cmsys/FStream.hxx> @@ -582,6 +584,18 @@ void cmQtAutoGenerators::SetupAutoGenerateTarget(cmTarget const* target) 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; +#if defined(WIN32) && !defined(__CYGWIN__) + mode_t mode_write = S_IWRITE; +#else + mode_t mode_write = S_IWUSR; +#endif + cmSystemTools::GetPermissions(outputFile, perm); + if (!(perm & mode_write)) + { + cmSystemTools::SetPermissions(outputFile, perm | mode_write); + } if (!configDefines.empty() || !configIncludes.empty() || !configUicOptions.empty()) |