From 4451cff698a4783984945bdf081ad3b914f4e48e Mon Sep 17 00:00:00 2001
From: "Joachim Wuttke (h)" <j.wuttke@fz-juelich.de>
Date: Wed, 2 Dec 2020 13:38:49 +0100
Subject: [PATCH] CMake: rm intermediate file, make dependence on GUI 3rd party
 more transparent

---
 CMakeLists.txt                |  3 ++-
 GUI/coregui/CMakeLists.txt    | 11 ++++++++---
 ThirdParty/GUI/CMakeLists.txt | 12 ------------
 3 files changed, 10 insertions(+), 16 deletions(-)
 delete mode 100644 ThirdParty/GUI/CMakeLists.txt

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2d4500d1d08..22a5795e833 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -135,7 +135,8 @@ endif()
 add_subdirectory(ThirdParty/common)
 add_subdirectory(ThirdParty/Core)
 if(BORNAGAIN_GUI)
-    add_subdirectory(ThirdParty/GUI)
+    add_subdirectory(ThirdParty/GUI/qt-manhattan-style)
+    add_subdirectory(ThirdParty/GUI/qcustomplot)
 endif()
 
 # from here on our own code, occasionally scrutinized by clang-tidy
diff --git a/GUI/coregui/CMakeLists.txt b/GUI/coregui/CMakeLists.txt
index db995c508df..4d5c36ab9d9 100644
--- a/GUI/coregui/CMakeLists.txt
+++ b/GUI/coregui/CMakeLists.txt
@@ -92,10 +92,15 @@ set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
 
 
 # --- dependencies ---------
-target_include_directories(${library_name} PUBLIC ${QtAddOn_INCLUDE_DIRS} ${CMAKE_SOURCE_DIR})
-target_include_directories(${library_name} PUBLIC ${include_dirs})
-target_link_libraries(${library_name} ${QtAddOn_LIBRARIES} ${BornAgainCore_LIBRARY} ${ba3d_LIBRARY})
+target_include_directories(${library_name} PUBLIC
+    ${ManhattanStyle_INCLUDE_DIRS}
+    ${qcustomplot_INCLUDE_DIRS}
+    ${CMAKE_SOURCE_DIR})
 target_link_libraries(${library_name}
+    ${ManhattanStyle_LIBRARY}
+    ${qcustomplot_LIBRARY}
+    ${BornAgainCore_LIBRARY}
+    ${ba3d_LIBRARY}
     Qt5::Widgets
     Qt5::Core
     Qt5::Gui
diff --git a/ThirdParty/GUI/CMakeLists.txt b/ThirdParty/GUI/CMakeLists.txt
deleted file mode 100644
index c8f8cea6c2d..00000000000
--- a/ThirdParty/GUI/CMakeLists.txt
+++ /dev/null
@@ -1,12 +0,0 @@
-add_subdirectory(qt-manhattan-style)
-add_subdirectory(qcustomplot)
-
-set(QtAddOn_INCLUDE_DIRS
-    ${ManhattanStyle_INCLUDE_DIRS}
-    ${qcustomplot_INCLUDE_DIRS}
-    PARENT_SCOPE)
-
-set(QtAddOn_LIBRARIES
-    ${ManhattanStyle_LIBRARY}
-    ${qcustomplot_LIBRARY}
-    PARENT_SCOPE)
-- 
GitLab