diff --git a/GUI/coregui/CMakeLists.txt b/GUI/coregui/CMakeLists.txt
index b3b40ef7ea62902315b4bdafd5146c1b54767ae2..309cbfa5dba10416d66229006dfb668912dec9b6 100644
--- a/GUI/coregui/CMakeLists.txt
+++ b/GUI/coregui/CMakeLists.txt
@@ -94,11 +94,9 @@ set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
 # --- dependencies ---------
 target_include_directories(${library_name} PUBLIC
     ${CMAKE_SOURCE_DIR}/ThirdParty/GUI # for qt-manhattan-style
-    ${qcustomplot_INCLUDE_DIRS}
     ${CMAKE_SOURCE_DIR})
 target_link_libraries(${library_name}
     ${ManhattanStyle_LIBRARY}
-    ${qcustomplot_LIBRARY}
     ${BornAgainCore_LIBRARY}
     ${ba3d_LIBRARY}
     Qt5::Widgets
@@ -107,6 +105,7 @@ target_link_libraries(${library_name}
     Qt5::Designer
     Qt5::PrintSupport
     Qt5::Network
+    qcustomplot
 )
 
 # --- Installation ---------
diff --git a/ThirdParty/GUI/qcustomplot/CMakeLists.txt b/ThirdParty/GUI/qcustomplot/CMakeLists.txt
index 21d5d4ac20e076464d6ebd751b7b61c9520b468f..b22e30b659941c83b2e42bd9dd7beef5f6c83dad 100644
--- a/ThirdParty/GUI/qcustomplot/CMakeLists.txt
+++ b/ThirdParty/GUI/qcustomplot/CMakeLists.txt
@@ -3,22 +3,7 @@
 ############################################################################
 set(library_name qcustomplot)
 
-set(source_files qcustomplot.h qcustomplot.cpp)
-
-set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
-
-add_library(
-    ${library_name}
-    STATIC
-    ${source_files} ${mocfiles}
-)
-set(${library_name}_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
-set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
-
-target_link_libraries(${library_name} ${Qt5Widgets_LIBRARIES})
-
-target_link_libraries(${library_name}
-    Qt5::Widgets
-    Qt5::PrintSupport
-)
+add_library(${library_name} STATIC qcustomplot.h qcustomplot.cpp)
+target_link_libraries(${library_name} PUBLIC Qt5::Widgets Qt5::PrintSupport)
+target_include_directories(${library_name} PUBLIC ${CMAKE_CURRENT_LIST_DIR})