From e539de27a374124c93faec273a2c0054550197fc Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Tue, 19 Mar 2019 14:49:44 +0100
Subject: [PATCH] [CMake] Fixed Qt platform installation in build-dir.

---
 scripts/cmake/ConanSetup.cmake                | 1 -
 scripts/cmake/packaging/PackagingMac.cmake    | 4 ++--
 scripts/cmake/packaging/PackagingMacros.cmake | 1 +
 scripts/cmake/packaging/PackagingWin.cmake    | 4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/scripts/cmake/ConanSetup.cmake b/scripts/cmake/ConanSetup.cmake
index d3cd29dc589..0e1eb108050 100644
--- a/scripts/cmake/ConanSetup.cmake
+++ b/scripts/cmake/ConanSetup.cmake
@@ -91,7 +91,6 @@ if(APPLE)
 endif()
 if(MSVC)
     set(CONAN_IMPORTS ${CONAN_IMPORTS} "bin, *.dll* -> ./bin")
-    set(CONAN_IMPORTS ${CONAN_IMPORTS} "plugins/platforms, *.dll* -> ./bin/platforms")
 endif()
 if(UNIX AND NOT APPLE)
     set(CONAN_IMPORTS ${CONAN_IMPORTS} "lib, *.so* -> ./lib")
diff --git a/scripts/cmake/packaging/PackagingMac.cmake b/scripts/cmake/packaging/PackagingMac.cmake
index 8854394bedc..3c5fb14a10e 100644
--- a/scripts/cmake/packaging/PackagingMac.cmake
+++ b/scripts/cmake/packaging/PackagingMac.cmake
@@ -27,8 +27,8 @@ endif()
 
 if(OGS_BUILD_GUI)
     install_qt5_plugin("Qt5::QCocoaIntegrationPlugin" QT_PLUGINS)
-    file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
+    file(WRITE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
         "[Paths]\nPlugins = ../${_qt_plugin_dir}\n")
-    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
+    install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
         DESTINATION bin COMPONENT ogs_gui)
 endif()
diff --git a/scripts/cmake/packaging/PackagingMacros.cmake b/scripts/cmake/packaging/PackagingMacros.cmake
index ba153c854b3..de831ab9536 100644
--- a/scripts/cmake/packaging/PackagingMacros.cmake
+++ b/scripts/cmake/packaging/PackagingMacros.cmake
@@ -75,6 +75,7 @@ macro(install_qt5_plugin _qt_plugin_name _qt_plugins_var)
             set(_qt_plugin_dir "plugins")
         endif()
         set(_qt_plugin_dest "${_qt_plugin_dir}/${_qt_plugin_type}")
+        file(COPY "${_qt_plugin_path}" DESTINATION "${_qt_plugin_dest}")
         install(FILES "${_qt_plugin_path}"
             DESTINATION "${_qt_plugin_dest}"
             ${COMPONENT})
diff --git a/scripts/cmake/packaging/PackagingWin.cmake b/scripts/cmake/packaging/PackagingWin.cmake
index 983881a9e2d..48ea5fdbeb8 100644
--- a/scripts/cmake/packaging/PackagingWin.cmake
+++ b/scripts/cmake/packaging/PackagingWin.cmake
@@ -29,8 +29,8 @@ endif()
 
 if(OGS_BUILD_GUI)
     install_qt5_plugin("Qt5::QWindowsIntegrationPlugin" QT_PLUGINS)
-    file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
+    file(WRITE "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
         "[Paths]\nPlugins = ../${_qt_plugin_dir}\n")
-    install(FILES "${CMAKE_CURRENT_BINARY_DIR}/qt.conf"
+    install(FILES "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/qt.conf"
         DESTINATION bin COMPONENT ogs_gui)
 endif()
-- 
GitLab