From fedab470faae6b7b057a0935ed8dba680cd0b37f Mon Sep 17 00:00:00 2001
From: Gennady Pospelov <g.pospelov@fz-juelich.de>
Date: Thu, 13 Nov 2014 15:09:32 +0100
Subject: [PATCH] CMake: clean up in ThirdParty, libManhattanStyle now is
 static library

---
 CMakeLists.txt                                |  2 --
 GUI/CMakeLists.txt                            | 15 ++++++--------
 GUI/externals/qcustomplot/CMakeLists.txt      |  8 +++++---
 .../qt-manhattan-style/CMakeLists.txt         | 14 ++++---------
 .../qtpropertybrowser/CMakeLists.txt          |  9 +++++----
 ThirdParty/RootMinimizers/CMakeLists.txt      | 20 ++++++-------------
 ThirdParty/gtest/CMakeLists.txt               |  3 +--
 7 files changed, 27 insertions(+), 44 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1786e4b14cc..0af9c4a8b96 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -39,8 +39,6 @@ if(BORNAGAIN_MAN)
     add_subdirectory(Doc/UserManual)
 endif()
 
-#set(CMAKE_MACOSX_RPATH 0)
-
 add_subdirectory(Core)
 add_subdirectory(ThirdParty/gtest)
 add_subdirectory(Tests/UnitTests/TestCore)
diff --git a/GUI/CMakeLists.txt b/GUI/CMakeLists.txt
index 8690abec2a6..153bc32190d 100644
--- a/GUI/CMakeLists.txt
+++ b/GUI/CMakeLists.txt
@@ -1,25 +1,21 @@
 ############################################################################
 # CMakeLists.txt file for building BornAgain/GUI libraries and executable
 ############################################################################
-
 cmake_minimum_required(VERSION 2.8.9 FATAL_ERROR)
 if(POLICY CMP0020)
-cmake_policy(SET CMP0020 NEW)
+    cmake_policy(SET CMP0020 NEW)
 endif()
 if(POLICY CMP0043)
-cmake_policy(SET CMP0043 NEW)
+    cmake_policy(SET CMP0043 NEW)
 endif()
 if(POLICY CMP0042)
-cmake_policy(SET CMP0042 NEW)
+    cmake_policy(SET CMP0042 NEW)
 endif()
 
 message(STATUS "Configuring BornAgain GUI")
 
-#if(POLICY CMP0020)
-#cmake_policy(SET CMP0020 NEW)
-#endif()
-
 find_package(Qt5Widgets REQUIRED)
+
 if(${Qt5Widgets_FOUND})
     message(STATUS "  Found Qt5 version ${Qt5Widgets_VERSION_STRING}")
     get_target_property(Qt5Widgets_location Qt5::Widgets LOCATION_Release)
@@ -35,12 +31,13 @@ add_subdirectory(externals/qt-manhattan-style)
 add_subdirectory(externals/qcustomplot)
 add_subdirectory(externals/qtpropertybrowser)
 add_subdirectory(coregui)
+
 if(BORNAGAIN_CRASHHADLER)
     add_definitions(-DBORNAGAIN_CRASHHANDLER)
     add_subdirectory(crashhandler)
 endif()
-add_subdirectory(main)
 
+add_subdirectory(main)
 
 set(BornAgainGUI_INCLUDE_DIRS ${BornAgainGUI_INCLUDE_DIRS} PARENT_SCOPE)
 set(BornAgainGUI_LIBRARY ${BornAgainGUI_LIBRARY} PARENT_SCOPE)
diff --git a/GUI/externals/qcustomplot/CMakeLists.txt b/GUI/externals/qcustomplot/CMakeLists.txt
index ae0dd59a255..63e393a3bea 100644
--- a/GUI/externals/qcustomplot/CMakeLists.txt
+++ b/GUI/externals/qcustomplot/CMakeLists.txt
@@ -1,11 +1,13 @@
+############################################################################
+# CMakeLists.txt file for building qcustomplot static library
+############################################################################
 cmake_minimum_required(VERSION 2.8.9)
 if(POLICY CMP0020)
-cmake_policy(SET CMP0020 NEW)
+    cmake_policy(SET CMP0020 NEW)
 endif()
 if(POLICY CMP0043)
-cmake_policy(SET CMP0043 NEW)
+    cmake_policy(SET CMP0043 NEW)
 endif()
-
 set(library_name qcustomplot)
 
 set(source_files qcustomplot.h qcustomplot.cpp)
diff --git a/GUI/externals/qt-manhattan-style/CMakeLists.txt b/GUI/externals/qt-manhattan-style/CMakeLists.txt
index 7fb09d3c488..a3b5883cb9d 100644
--- a/GUI/externals/qt-manhattan-style/CMakeLists.txt
+++ b/GUI/externals/qt-manhattan-style/CMakeLists.txt
@@ -1,19 +1,17 @@
 ############################################################################
 # CMakeLists.txt file for building libManhattanStyle
 ############################################################################
-
 cmake_minimum_required(VERSION 2.8.9)
 if(POLICY CMP0020)
-cmake_policy(SET CMP0020 NEW)
+    cmake_policy(SET CMP0020 NEW)
 endif()
 if(POLICY CMP0043)
-cmake_policy(SET CMP0043 NEW)
+    cmake_policy(SET CMP0043 NEW)
 endif()
 if(POLICY CMP0042)
-cmake_policy(SET CMP0042 NEW)
+    cmake_policy(SET CMP0042 NEW)
 endif()
 
-#project(qt-manhattan-style)
 set(library_name ManhattanStyle)
 
 set(SRCS
@@ -72,7 +70,6 @@ set(UI_FILES
 # Qt5
 set(CMAKE_INCLUDE_CURRENT_DIR ON)
 set(CMAKE_AUTOMOC ON)
-#find_package(Qt5Widgets)
 
 # Run uic on ui files
 qt5_wrap_ui(UI_HDRS ${UI_FILES})
@@ -86,7 +83,7 @@ add_definitions(-DQT_DISABLE_DEPRECATED_BEFORE=0x040900)
 
 # Create the target
 add_definitions(-DQTMANHATTANSTYLE_LIBRARY)
-add_library(${library_name} SHARED ${SRCS} ${UI_HDRS} ${RC_SRCS})
+add_library(${library_name} STATIC ${SRCS} ${UI_HDRS} ${RC_SRCS})
 set(${library_name}_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE)
 set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
 
@@ -97,6 +94,3 @@ target_link_libraries(${library_name} ${Qt5Widgets_LIBRARIES})
 
 qt5_use_modules(${library_name} Widgets)
 
-# --- installation ---
-install (TARGETS ${library_name} DESTINATION ${destination_lib} COMPONENT Libraries)
-
diff --git a/GUI/externals/qtpropertybrowser/CMakeLists.txt b/GUI/externals/qtpropertybrowser/CMakeLists.txt
index 3c1e738413a..726588a00aa 100644
--- a/GUI/externals/qtpropertybrowser/CMakeLists.txt
+++ b/GUI/externals/qtpropertybrowser/CMakeLists.txt
@@ -1,14 +1,15 @@
+############################################################################
+# CMakeLists.txt file for building static qtpropertybrowser library from qtsolutions
+############################################################################
 cmake_minimum_required(VERSION 2.8.9)
 if(POLICY CMP0020)
-cmake_policy(SET CMP0020 NEW)
+    cmake_policy(SET CMP0020 NEW)
 endif()
 if(POLICY CMP0043)
-cmake_policy(SET CMP0043 NEW)
+    cmake_policy(SET CMP0043 NEW)
 endif()
-
 set(library_name qtpropertybrowser)
 
-
 file(GLOB source_files "*.cpp")
 file(GLOB include_files "*.h")
 
diff --git a/ThirdParty/RootMinimizers/CMakeLists.txt b/ThirdParty/RootMinimizers/CMakeLists.txt
index 8431b802c3e..ddc8fd39a63 100644
--- a/ThirdParty/RootMinimizers/CMakeLists.txt
+++ b/ThirdParty/RootMinimizers/CMakeLists.txt
@@ -1,10 +1,9 @@
 ############################################################################
 # CMakeLists.txt file for building libRootMinimizers package
 ############################################################################
-
 set(library_name RootMinimizers)
 
-# source and include files
+# --- source and include files ---------
 set(include_dirs
     ${CMAKE_CURRENT_SOURCE_DIR}/inc
 )
@@ -23,39 +22,32 @@ file(GLOB include_files
     "src/Math/*.h"
 )
 
-
 if(NOT ROOT_FOUND)
     list(REMOVE_ITEM source_files "${CMAKE_CURRENT_SOURCE_DIR}/src/Math/GeneticMinimizer.cxx")
     list(REMOVE_ITEM include_files "${CMAKE_CURRENT_SOURCE_DIR}/inc/Math/GeneticMinimizer.h")
 endif()
 
 
+# --- definitions ---------
 add_definitions(-DWARNINGMSG)
-
 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DMATH_NO_PLUGIN_MANAGER -DHAS_MINUIT2 -DR__HAS_MATHMORE")
 
-# --- making library ---
+
+# --- making library ------------
 add_library(
     ${library_name}
     STATIC
     ${source_files} ${include_files}
 )
-#set_Target_properties(${library_name} PROPERTIES PREFIX ${libprefix} SUFFIX ${libsuffix})
-#set(${library_name}_LIBRARY_TYPE SHARED)
-# exposing library name and list of include directories outside
 set(${library_name}_INCLUDE_DIRS ${include_dirs} PARENT_SCOPE)
 set(${library_name}_LIBRARY ${library_name} PARENT_SCOPE)
 
+
 # --- external dependencies ---
 include_directories(${GSL_INCLUDE_DIR})
 target_link_libraries(${library_name} ${GSL_LIBRARIES})
 
 if(ROOT_FOUND)
-    include_directories(
-        ${ROOT_INCLUDE_DIR}
-    )
+    include_directories(${ROOT_INCLUDE_DIR})
 endif()
 
-
-# --- installation ---
-#install (TARGETS ${library_name} DESTINATION ${destination_lib} COMPONENT Libraries)
diff --git a/ThirdParty/gtest/CMakeLists.txt b/ThirdParty/gtest/CMakeLists.txt
index ae244f3feb5..1d0762c03fb 100644
--- a/ThirdParty/gtest/CMakeLists.txt
+++ b/ThirdParty/gtest/CMakeLists.txt
@@ -1,9 +1,8 @@
 ############################################################################
 # CMakeLists.txt file for building gtest library
 ############################################################################
-
 if(POLICY CMP0042)
-cmake_policy(SET CMP0042 NEW)
+    cmake_policy(SET CMP0042 NEW)
 endif()
 
 if(MSVC)
-- 
GitLab