[Cmake-commits] CMake branch, next, updated. v3.6.0-rc1-184-gbb18617

Brad King brad.king at kitware.com
Thu Jun 9 13:19:32 EDT 2016


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "CMake".

The branch, next has been updated
       via  bb186170a4954d219bc2e799df8d7caa77a88ac0 (commit)
       via  d337cb414e1534322eb284fb3a1c73d68593a313 (commit)
      from  937e6f484223ebe17fb729a01b5494c3ed1f6cd2 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=bb186170a4954d219bc2e799df8d7caa77a88ac0
commit bb186170a4954d219bc2e799df8d7caa77a88ac0
Merge: 937e6f4 d337cb41
Author:     Brad King <brad.king at kitware.com>
AuthorDate: Thu Jun 9 13:19:31 2016 -0400
Commit:     CMake Topic Stage <kwrobot at kitware.com>
CommitDate: Thu Jun 9 13:19:31 2016 -0400

    Merge topic 'cmake-gui-osx-symlink-qt5-plugin' into next
    
    d337cb41 cmake-gui: Teach Qt5 where plugins are when launched through a symlink


https://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=d337cb414e1534322eb284fb3a1c73d68593a313
commit d337cb414e1534322eb284fb3a1c73d68593a313
Author:     Robert Maynard <robert.maynard at kitware.com>
AuthorDate: Thu Jun 9 08:23:47 2016 -0400
Commit:     Brad King <brad.king at kitware.com>
CommitDate: Thu Jun 9 13:13:39 2016 -0400

    cmake-gui: Teach Qt5 where plugins are when launched through a symlink
    
    When we are on OSX and we are launching cmake-gui from a symlink, the
    application will fail to launch as it can't find the qt.conf file which
    tells it what the name of the plugin folder is. We need to add this path
    BEFORE the application is constructed as that is what triggers the
    searching for the platform plugins

diff --git a/Source/QtDialog/CMakeSetup.cxx b/Source/QtDialog/CMakeSetup.cxx
index c3c1468..6035822 100644
--- a/Source/QtDialog/CMakeSetup.cxx
+++ b/Source/QtDialog/CMakeSetup.cxx
@@ -19,6 +19,7 @@
 #include <QApplication>
 #include <QDir>
 #include <QLocale>
+#include <QString>
 #include <QTextCodec>
 #include <QTranslator>
 #include <cmsys/CommandLineArguments.hxx>
@@ -40,6 +41,7 @@ static const char* cmDocumentationOptions[][2] = { { 0, 0 } };
 
 #if defined(Q_OS_MAC)
 static int cmOSXInstall(std::string dir);
+static void cmAddPluginPath();
 #endif
 
 int main(int argc, char** argv)
@@ -81,6 +83,15 @@ int main(int argc, char** argv)
   }
 #endif
 
+// When we are on OSX and we are launching cmake-gui from a symlink, the
+// application will fail to launch as it can't find the qt.conf file which
+// tells it what the name of the plugin folder is. We need to add this path
+// BEFORE the application is constructed as that is what triggers the
+// searching for the platform plugins
+#if defined(Q_OS_MAC)
+  cmAddPluginPath();
+#endif
+
   QApplication app(argc, argv);
 
   setlocale(LC_NUMERIC, "C");
@@ -215,4 +226,27 @@ static int cmOSXInstall(std::string dir)
     ? 0
     : 1;
 }
+
+// Locate the PlugIns directory and add it to the QApplication library paths.
+// We need to resolve all symlinks so we have a known relative path between
+// MacOS/CMake and the PlugIns directory.
+//
+// Note we are using cmSystemTools sine Qt can't provide the path to the
+// executable before the QApplication is created, and that is when plugin
+// searching occurs.
+static void cmAddPluginPath()
+{
+  std::string const& path = cmSystemTools::GetCMakeGUICommand();
+  if (path.empty()) {
+    return;
+  }
+  std::string const& realPath = cmSystemTools::GetRealPath(path);
+  QFileInfo appPath(QString::fromLocal8Bit(realPath.c_str()));
+  QDir pluginDir = appPath.dir();
+  bool const foundPluginDir = pluginDir.cd("../PlugIns");
+  if (foundPluginDir) {
+    QApplication::addLibraryPath(pluginDir.path());
+  }
+}
+
 #endif

-----------------------------------------------------------------------

Summary of changes:
 Source/QtDialog/CMakeSetup.cxx |   34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)


hooks/post-receive
-- 
CMake


More information about the Cmake-commits mailing list