summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2015-03-23 13:18:38 (GMT)
committerCMake Topic Stage <kwrobot@kitware.com>2015-03-23 13:18:38 (GMT)
commit114ddb072ce309df64806800550823f656845e77 (patch)
tree285afc497dfc0c92200a225f5ecd3758876f8bc1 /Source
parent45583e52728584385f67e68aac0998368042f23f (diff)
parent610464c12e0ef71b2bea28973b70630c4ce9a70e (diff)
downloadCMake-114ddb072ce309df64806800550823f656845e77.zip
CMake-114ddb072ce309df64806800550823f656845e77.tar.gz
CMake-114ddb072ce309df64806800550823f656845e77.tar.bz2
Merge topic 'autogen-write-access'
610464c1 QtAutogen: Ensure write access to AutogenInfo.cmake (#15416)
Diffstat (limited to 'Source')
-rw-r--r--Source/cmQtAutoGenerators.cxx14
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())