-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I ran into an issue when the Modules directory is read-only, I
received a "Internal CMake error when trying to open file"... from
cmQtAutoGenerators.

ConfigureFile use the source file's permissions, but
cmQtAutoGenerators::SetupAutoGenerateTarget requires write access.

The attached patch is a quick work-around.

- -- 
Thanks,
Justin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBAgAGBQJVCipnAAoJEJaK8jpvPrt2hYsP/izxGsO7aqicMv+w6sEGVwbq
cvknvxMAluAeJytr31ENFdvPC8NpO3EC/OgnP7JXwTwYXtjzV0IHE4qOlPApcYo4
Id/Wh2ZS5KJsBB0lQhOXwG7XlAmIli49SaYYii6/zAnWnlu19Bf3Wsvt/zDlsH2D
7G5gm/8ToxX0UpBktOx8e3sLsTTHVkeqSCTEvDqTsM9OvAizX2waDmuCvLp2GDS5
rQfxxkl78199UVA7YuGDz0mo20OOaW5RqUmWnV+oOR9HN9LfnvzP/6sgJvmOW/I6
vk4PEHsTXvwPv17z+hSS85R9UlSTVj67Yyk5GfzQ8GAYsYecfLyoXOGocka9jQ1F
+Oa9K5m8heKfmj5ldTn9qGCvrkFcffQqEtgcoyX0ELVaH9JcNFGEAN33JWMAuNA9
W1eyoO9Wzvd2i+S/TEpiLwsPtXXijTsBZeFfpD7+08LT0dvQ58XbT6PkJi/qOUGT
+0zODeKhsj2NH5PR7MLUK6Efh5/beAXAiN9q/FyjeBPQhIGDx8g+G7OXmcgu3tLd
GaVWx/GII3uqZoTMDKdg+KEKt7eBpQGgcrav5idNHldRhCWYG2zHfB8UnNOJvHr/
AkBpHRF7XRcYSHKHwTB0BLV7gBzVl1lX0+RXN3cpdEWJNatkeFvnS7A03UU3sLM1
NmV2qo+eZNjTeVR++dNJ
=WVVL
-----END PGP SIGNATURE-----
From c72617c0830098b9d9bd6e9566a5fc64aa7ef363 Mon Sep 17 00:00:00 2001
From: Justin Borodinsky <justin.borodin...@gmail.com>
Date: Wed, 18 Mar 2015 20:30:26 -0500
Subject: [PATCH] ensure write access to AutogenInfo.cmake

---
 Source/cmQtAutoGenerators.cxx | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/Source/cmQtAutoGenerators.cxx b/Source/cmQtAutoGenerators.cxx
index 42c18f7..3f7f658 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);
 
+  //Write permission is necessary
+  mode_t perm = 0;
+#if defined(WIN32) && !defined(__CYGWIN__)
+  mode_t mode_write = S_IWRITE;
+#else
+  mode_t mode_write = S_IWUSR | S_IWGRP | S_IWOTH;
+#endif
+  cmSystemTools::GetPermissions(outputFile.c_str(), perm);
+  if (!(perm & mode_write))
+    {
+    cmSystemTools::SetPermissions(outputFile.c_str(), perm | mode_write);
+    }
   if (!configDefines.empty()
       || !configIncludes.empty()
       || !configUicOptions.empty())
-- 
2.0.5

-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/cmake-developers

Reply via email to