From 5b8f4582fb975048f4d673f79203ad9c5b3f1a38 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Fri, 14 Sep 2018 12:48:18 +0200
Subject: [PATCH] [CMake] Install shared libraries.

---
 Applications/ApplicationsLib/CMakeLists.txt               | 3 +++
 Applications/DataExplorer/Base/CMakeLists.txt             | 3 +++
 Applications/DataExplorer/DataView/CMakeLists.txt         | 3 +++
 .../DataExplorer/DataView/DiagramView/CMakeLists.txt      | 3 +++
 .../DataExplorer/DataView/StratView/CMakeLists.txt        | 3 +++
 Applications/DataExplorer/NetCdfDialog/CMakeLists.txt     | 3 +++
 Applications/DataExplorer/VtkVis/CMakeLists.txt           | 3 +++
 Applications/DataHolderLib/CMakeLists.txt                 | 3 +++
 Applications/FileIO/CMakeLists.txt                        | 3 +++
 Applications/InSituLib/CMakeLists.txt                     | 3 +++
 BaseLib/CMakeLists.txt                                    | 3 +++
 GeoLib/CMakeLists.txt                                     | 3 +++
 MaterialLib/CMakeLists.txt                                | 3 +++
 MathLib/CMakeLists.txt                                    | 3 +++
 MeshGeoToolsLib/CMakeLists.txt                            | 3 +++
 MeshLib/CMakeLists.txt                                    | 3 +++
 NumLib/CMakeLists.txt                                     | 3 +++
 ProcessLib/BoundaryCondition/Python/CMakeLists.txt        | 8 ++++++++
 ProcessLib/CMakeLists.txt                                 | 3 +++
 ProcessLib/ComponentTransport/CMakeLists.txt              | 3 +++
 ProcessLib/GroundwaterFlow/CMakeLists.txt                 | 3 +++
 ProcessLib/HT/CMakeLists.txt                              | 3 +++
 ProcessLib/HeatConduction/CMakeLists.txt                  | 3 +++
 ProcessLib/HydroMechanics/CMakeLists.txt                  | 3 +++
 ProcessLib/LIE/CMakeLists.txt                             | 3 +++
 ProcessLib/LiquidFlow/CMakeLists.txt                      | 3 +++
 ProcessLib/PhaseField/CMakeLists.txt                      | 3 +++
 ProcessLib/RichardsComponentTransport/CMakeLists.txt      | 3 +++
 ProcessLib/RichardsFlow/CMakeLists.txt                    | 3 +++
 ProcessLib/RichardsMechanics/CMakeLists.txt               | 3 +++
 ProcessLib/SmallDeformation/CMakeLists.txt                | 3 +++
 ProcessLib/TES/CMakeLists.txt                             | 3 +++
 ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt       | 3 +++
 ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt      | 3 +++
 ProcessLib/ThermoMechanics/CMakeLists.txt                 | 3 +++
 ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt              | 3 +++
 ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt            | 3 +++
 ThirdParty/logog/CMakeLists.txt                           | 6 +++++-
 scripts/cmake/MetisSetup.cmake                            | 3 +++
 39 files changed, 124 insertions(+), 1 deletion(-)

diff --git a/Applications/ApplicationsLib/CMakeLists.txt b/Applications/ApplicationsLib/CMakeLists.txt
index 9d734bcb839..a0bbc6d0eb0 100644
--- a/Applications/ApplicationsLib/CMakeLists.txt
+++ b/Applications/ApplicationsLib/CMakeLists.txt
@@ -4,6 +4,9 @@ set(LIB_SOURCES ${SOURCES_APPLICATIONSLIB})
 
 # Library
 add_library(ApplicationsLib ${LIB_SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ApplicationsLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(ApplicationsLib
     PUBLIC BaseLib GeoLib Processes logog
diff --git a/Applications/DataExplorer/Base/CMakeLists.txt b/Applications/DataExplorer/Base/CMakeLists.txt
index e2529a875b2..c8f22d0819c 100644
--- a/Applications/DataExplorer/Base/CMakeLists.txt
+++ b/Applications/DataExplorer/Base/CMakeLists.txt
@@ -35,6 +35,9 @@ add_library(QtBase
     ${SOURCES}
     ${HEADERS}
 )
+if(BUILD_SHARED_LIBS)
+    install(TARGETS QtBase LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(QtBase Qt5::Widgets)
 
diff --git a/Applications/DataExplorer/DataView/CMakeLists.txt b/Applications/DataExplorer/DataView/CMakeLists.txt
index 635ee147499..97e948f7fed 100644
--- a/Applications/DataExplorer/DataView/CMakeLists.txt
+++ b/Applications/DataExplorer/DataView/CMakeLists.txt
@@ -129,6 +129,9 @@ add_library(QtDataView
     ${HEADERS}
     ${UIS}
 )
+if(BUILD_SHARED_LIBS)
+    install(TARGETS QtDataView LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(QtDataView
     PUBLIC GeoLib MeshGeoToolsLib MeshLib QtBase VtkVis
diff --git a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt
index 558733cebed..d8f572e157d 100644
--- a/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt
+++ b/Applications/DataExplorer/DataView/DiagramView/CMakeLists.txt
@@ -38,6 +38,9 @@ add_library(QtDiagramView
     ${HEADERS}
     ${UIS}
 )
+if(BUILD_SHARED_LIBS)
+    install(TARGETS QtDiagramView LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(QtDiagramView
     PRIVATE BaseLib GeoLib QtBase DataHolderLib Qt5::Gui logog
diff --git a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt
index ced706d48a5..40a37ed9597 100644
--- a/Applications/DataExplorer/DataView/StratView/CMakeLists.txt
+++ b/Applications/DataExplorer/DataView/StratView/CMakeLists.txt
@@ -30,6 +30,9 @@ add_library(QtStratView
     ${HEADERS}
     ${UIS}
 )
+if(BUILD_SHARED_LIBS)
+    install(TARGETS QtStratView LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(QtStratView
     PRIVATE BaseLib GeoLib DataHolderLib QtBase Qt5::Gui
diff --git a/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt b/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt
index a5e2a4f90da..1abed72e61e 100644
--- a/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt
+++ b/Applications/DataExplorer/NetCdfDialog/CMakeLists.txt
@@ -1,4 +1,7 @@
 add_library(NetCdfDialogLib NetCdfConfigureDialog.cpp NetCdfConfigureDialog.h)
+if(BUILD_SHARED_LIBS)
+    install(TARGETS NetCdfConfigureDialog LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(NetCdfDialogLib PUBLIC Qt5::Widgets PRIVATE MathLib vtknetcdfcpp)
 set_property(TARGET NetCdfDialogLib PROPERTY FOLDER "DataExplorer")
 
diff --git a/Applications/DataExplorer/VtkVis/CMakeLists.txt b/Applications/DataExplorer/VtkVis/CMakeLists.txt
index 4274231d691..80f65891c83 100644
--- a/Applications/DataExplorer/VtkVis/CMakeLists.txt
+++ b/Applications/DataExplorer/VtkVis/CMakeLists.txt
@@ -128,6 +128,9 @@ add_library(VtkVis
     ${HEADERS}
     ${UIS}
 )
+if(BUILD_SHARED_LIBS)
+    install(TARGETS VtkVis LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 if(GEOTIFF_FOUND)
     include_directories(${GEOTIFF_INCLUDE_DIRS})
diff --git a/Applications/DataHolderLib/CMakeLists.txt b/Applications/DataHolderLib/CMakeLists.txt
index 9740aafa4b5..7f23991438f 100644
--- a/Applications/DataHolderLib/CMakeLists.txt
+++ b/Applications/DataHolderLib/CMakeLists.txt
@@ -3,6 +3,9 @@ GET_SOURCE_FILES(SOURCES_DataHolderLib)
 
 # Library
 add_library(DataHolderLib ${SOURCES_DataHolderLib})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS DataHolderLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(DataHolderLib
     PUBLIC GeoLib MeshLib
diff --git a/Applications/FileIO/CMakeLists.txt b/Applications/FileIO/CMakeLists.txt
index 283ae99707f..9f624790b0d 100644
--- a/Applications/FileIO/CMakeLists.txt
+++ b/Applications/FileIO/CMakeLists.txt
@@ -20,6 +20,9 @@ include(${PROJECT_SOURCE_DIR}/scripts/cmake/OGSEnabledElements.cmake)
 
 # Create the library
 add_library(ApplicationsFileIO ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ApplicationsFileIO LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(ApplicationsFileIO
     PUBLIC BaseLib DataHolderLib GeoLib MathLib logog
     PRIVATE MeshLib
diff --git a/Applications/InSituLib/CMakeLists.txt b/Applications/InSituLib/CMakeLists.txt
index 732d546c4e5..486ef6cba61 100644
--- a/Applications/InSituLib/CMakeLists.txt
+++ b/Applications/InSituLib/CMakeLists.txt
@@ -3,6 +3,9 @@ GET_SOURCE_FILES(SOURCES)
 
 # Library
 add_library(InSituLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS InSituLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(PUBLIC BaseLib PRIVATE MeshLib)
 
diff --git a/BaseLib/CMakeLists.txt b/BaseLib/CMakeLists.txt
index c7bea9cdcf5..ec1c2013b18 100644
--- a/BaseLib/CMakeLists.txt
+++ b/BaseLib/CMakeLists.txt
@@ -11,6 +11,9 @@ list(APPEND SOURCES "${CMAKE_CURRENT_BINARY_DIR}/BuildInfo.cpp" BuildInfo.h)
 
 # Create the library
 add_library(BaseLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS BaseLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 include(GenerateExportHeader)
 generate_export_header(BaseLib)
diff --git a/GeoLib/CMakeLists.txt b/GeoLib/CMakeLists.txt
index c33ba515a66..be49c05a839 100644
--- a/GeoLib/CMakeLists.txt
+++ b/GeoLib/CMakeLists.txt
@@ -12,6 +12,9 @@ endif()
 
 # Create the library
 add_library(GeoLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS GeoLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(GeoLib PUBLIC BaseLib MathLib logog PRIVATE tet)
 
diff --git a/MaterialLib/CMakeLists.txt b/MaterialLib/CMakeLists.txt
index 236ac28865e..4c7c4d266e5 100644
--- a/MaterialLib/CMakeLists.txt
+++ b/MaterialLib/CMakeLists.txt
@@ -22,6 +22,9 @@ append_source_files(SOURCES PorousMedium/UnsaturatedProperty/RelativePermeabilit
 append_source_files(SOURCES TwoPhaseModels)
 
 add_library(MaterialLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS MaterialLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 include(GenerateExportHeader)
 generate_export_header(MaterialLib)
diff --git a/MathLib/CMakeLists.txt b/MathLib/CMakeLists.txt
index 26f2c130cf0..8a51e27b4ca 100644
--- a/MathLib/CMakeLists.txt
+++ b/MathLib/CMakeLists.txt
@@ -26,6 +26,9 @@ endif()
 
 # Create the library
 add_library(MathLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS MathLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 include(GenerateExportHeader)
 generate_export_header(MathLib)
diff --git a/MeshGeoToolsLib/CMakeLists.txt b/MeshGeoToolsLib/CMakeLists.txt
index d890eb18995..983138fab6b 100644
--- a/MeshGeoToolsLib/CMakeLists.txt
+++ b/MeshGeoToolsLib/CMakeLists.txt
@@ -3,6 +3,9 @@ GET_SOURCE_FILES(SOURCES)
 
 # Create the library
 add_library(MeshGeoToolsLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS MeshGeoToolsLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(MeshGeoToolsLib
     PUBLIC GeoLib MathLib
diff --git a/MeshLib/CMakeLists.txt b/MeshLib/CMakeLists.txt
index 07135d8fd68..3b099e405e6 100644
--- a/MeshLib/CMakeLists.txt
+++ b/MeshLib/CMakeLists.txt
@@ -22,6 +22,9 @@ endif()
 
 # Create the library
 add_library(MeshLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS MeshLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 if(OGS_USE_PCH)
     cotire(MeshLib)
 endif()
diff --git a/NumLib/CMakeLists.txt b/NumLib/CMakeLists.txt
index 3809f1347c3..efd3ad4b46b 100644
--- a/NumLib/CMakeLists.txt
+++ b/NumLib/CMakeLists.txt
@@ -16,6 +16,9 @@ APPEND_SOURCE_FILES(SOURCES Extrapolation)
 
 # Create the library
 add_library(NumLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS NumLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 include(GenerateExportHeader)
 generate_export_header(NumLib)
 target_include_directories(NumLib PUBLIC ${CMAKE_CURRENT_BINARY_DIR})
diff --git a/ProcessLib/BoundaryCondition/Python/CMakeLists.txt b/ProcessLib/BoundaryCondition/Python/CMakeLists.txt
index 30cfd3828bd..52b1f9da15c 100644
--- a/ProcessLib/BoundaryCondition/Python/CMakeLists.txt
+++ b/ProcessLib/BoundaryCondition/Python/CMakeLists.txt
@@ -3,6 +3,10 @@ add_library(ProcessLibBoundaryConditionPython
     PythonBoundaryCondition.h
     PythonBoundaryConditionLocalAssembler.h
     PythonBoundaryConditionPythonSideInterface.h)
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ProcessLibBoundaryConditionPython
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_compile_definitions(ProcessLibBoundaryConditionPython
     PUBLIC OGS_USE_PYTHON)
@@ -15,6 +19,10 @@ target_link_libraries(ProcessLibBoundaryConditionPython
 add_library(ProcessLibBoundaryConditionPythonModule
     PythonBoundaryConditionModule.cpp
     PythonBoundaryConditionModule.h)
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ProcessLibBoundaryConditionPythonModule
+        LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(ProcessLibBoundaryConditionPythonModule
     PUBLIC
diff --git a/ProcessLib/CMakeLists.txt b/ProcessLib/CMakeLists.txt
index b2e9ad01e85..5b64144df7f 100644
--- a/ProcessLib/CMakeLists.txt
+++ b/ProcessLib/CMakeLists.txt
@@ -20,6 +20,9 @@ APPEND_SOURCE_FILES(SOURCES SourceTerms)
 APPEND_SOURCE_FILES(SOURCES Utils)
 
 add_library(ProcessLib ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ProcessLib LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(ProcessLib
     PUBLIC BaseLib MaterialLib MathLib MeshLib NumLib logog MeshGeoToolsLib
diff --git a/ProcessLib/ComponentTransport/CMakeLists.txt b/ProcessLib/ComponentTransport/CMakeLists.txt
index 8fd79d9b1ac..0b90efa851b 100644
--- a/ProcessLib/ComponentTransport/CMakeLists.txt
+++ b/ProcessLib/ComponentTransport/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(ComponentTransport ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ComponentTransport LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(ComponentTransport
     PUBLIC ProcessLib
diff --git a/ProcessLib/GroundwaterFlow/CMakeLists.txt b/ProcessLib/GroundwaterFlow/CMakeLists.txt
index df390e0d3eb..b60fc65b178 100644
--- a/ProcessLib/GroundwaterFlow/CMakeLists.txt
+++ b/ProcessLib/GroundwaterFlow/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(GroundwaterFlow ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS GroundwaterFlow LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 target_link_libraries(GroundwaterFlow
     PUBLIC ProcessLib
diff --git a/ProcessLib/HT/CMakeLists.txt b/ProcessLib/HT/CMakeLists.txt
index ad8493534eb..0adfff1a8c7 100644
--- a/ProcessLib/HT/CMakeLists.txt
+++ b/ProcessLib/HT/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(HT ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS HT LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(HT PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/HeatConduction/CMakeLists.txt b/ProcessLib/HeatConduction/CMakeLists.txt
index dab843c3693..d254ac48d55 100644
--- a/ProcessLib/HeatConduction/CMakeLists.txt
+++ b/ProcessLib/HeatConduction/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(HeatConduction ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS HeatConduction LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(HeatConduction PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/HydroMechanics/CMakeLists.txt b/ProcessLib/HydroMechanics/CMakeLists.txt
index 5ac96f99ae4..abd91957bfb 100644
--- a/ProcessLib/HydroMechanics/CMakeLists.txt
+++ b/ProcessLib/HydroMechanics/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(HydroMechanics ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS HydroMechanics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(HydroMechanics PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/LIE/CMakeLists.txt b/ProcessLib/LIE/CMakeLists.txt
index 9fc910c8815..124f58a67f1 100644
--- a/ProcessLib/LIE/CMakeLists.txt
+++ b/ProcessLib/LIE/CMakeLists.txt
@@ -5,6 +5,9 @@ APPEND_SOURCE_FILES(SOURCES SmallDeformation)
 APPEND_SOURCE_FILES(SOURCES SmallDeformation/LocalAssembler)
 
 add_library(LIE ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS LIE LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(LIE PUBLIC ProcessLib)
 
 include(HydroMechanics/Tests.cmake)
diff --git a/ProcessLib/LiquidFlow/CMakeLists.txt b/ProcessLib/LiquidFlow/CMakeLists.txt
index 9324f6ac396..b6a430d96d2 100644
--- a/ProcessLib/LiquidFlow/CMakeLists.txt
+++ b/ProcessLib/LiquidFlow/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(LiquidFlow ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS LiquidFlow LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(LiquidFlow PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/PhaseField/CMakeLists.txt b/ProcessLib/PhaseField/CMakeLists.txt
index 6a541ed532b..d3575e49e7e 100644
--- a/ProcessLib/PhaseField/CMakeLists.txt
+++ b/ProcessLib/PhaseField/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(PhaseField ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS PhaseField LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(PhaseField PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/RichardsComponentTransport/CMakeLists.txt b/ProcessLib/RichardsComponentTransport/CMakeLists.txt
index 8a8a9ec2f73..1ea94214a51 100644
--- a/ProcessLib/RichardsComponentTransport/CMakeLists.txt
+++ b/ProcessLib/RichardsComponentTransport/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(RichardsComponentTransport ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS RichardsComponentTransport LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(RichardsComponentTransport PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/RichardsFlow/CMakeLists.txt b/ProcessLib/RichardsFlow/CMakeLists.txt
index b7647cf90ff..ce0770b7546 100644
--- a/ProcessLib/RichardsFlow/CMakeLists.txt
+++ b/ProcessLib/RichardsFlow/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(RichardsFlow ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS RichardsFlow LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(RichardsFlow PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/RichardsMechanics/CMakeLists.txt b/ProcessLib/RichardsMechanics/CMakeLists.txt
index 6e124260816..6886684b525 100644
--- a/ProcessLib/RichardsMechanics/CMakeLists.txt
+++ b/ProcessLib/RichardsMechanics/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(RichardsMechanics ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS RichardsMechanics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(RichardsMechanics PUBLIC ProcessLib RichardsFlow)
 
 include(Tests.cmake)
diff --git a/ProcessLib/SmallDeformation/CMakeLists.txt b/ProcessLib/SmallDeformation/CMakeLists.txt
index 341d2ebe76b..a2fee7f8872 100644
--- a/ProcessLib/SmallDeformation/CMakeLists.txt
+++ b/ProcessLib/SmallDeformation/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(SmallDeformation ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS SmallDeformation LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(SmallDeformation PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/TES/CMakeLists.txt b/ProcessLib/TES/CMakeLists.txt
index 1a80afc2301..d1632b69016 100644
--- a/ProcessLib/TES/CMakeLists.txt
+++ b/ProcessLib/TES/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(TES ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS TES LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(TES PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt b/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
index 141baacb344..3c5d458490f 100644
--- a/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
+++ b/ProcessLib/ThermalTwoPhaseFlowWithPP/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(ThermalTwoPhaseFlowWithPP ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ThermalTwoPhaseFlowWithPP LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(ThermalTwoPhaseFlowWithPP PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt b/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt
index 48a52b712d1..d13bd372521 100644
--- a/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt
+++ b/ProcessLib/ThermoMechanicalPhaseField/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(ThermoMechanicalPhaseField ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ThermoMechanicalPhaseField LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(ThermoMechanicalPhaseField PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/ThermoMechanics/CMakeLists.txt b/ProcessLib/ThermoMechanics/CMakeLists.txt
index 3d6de7a861c..7368f6f8d2e 100644
--- a/ProcessLib/ThermoMechanics/CMakeLists.txt
+++ b/ProcessLib/ThermoMechanics/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(ThermoMechanics ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS ThermoMechanics LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(ThermoMechanics PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt b/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
index 1a186fc256b..5b194400ac1 100644
--- a/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
+++ b/ProcessLib/TwoPhaseFlowWithPP/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(TwoPhaseFlowWithPP ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS TwoPhaseFlowWithPP LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(TwoPhaseFlowWithPP PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt b/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
index cc04858fe35..0574fb24517 100644
--- a/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
+++ b/ProcessLib/TwoPhaseFlowWithPrho/CMakeLists.txt
@@ -1,6 +1,9 @@
 APPEND_SOURCE_FILES(SOURCES)
 
 add_library(TwoPhaseFlowWithPrho ${SOURCES})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS TwoPhaseFlowWithPrho LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 target_link_libraries(TwoPhaseFlowWithPrho PUBLIC ProcessLib)
 
 include(Tests.cmake)
diff --git a/ThirdParty/logog/CMakeLists.txt b/ThirdParty/logog/CMakeLists.txt
index 3b244eda44e..bfdf3f09fb9 100644
--- a/ThirdParty/logog/CMakeLists.txt
+++ b/ThirdParty/logog/CMakeLists.txt
@@ -53,5 +53,9 @@ if (CMAKE_PROJECT_NAME STREQUAL logog)
 		add_custom_target (logog-doc ${DOXYGEN_EXECUTABLE} ${CMAKE_SOURCE_DIR}/doxyfile
 			WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
 			COMMENT "Generating source code documentation with Doxygen." VERBATIM)
-	endif() # DOXYGEN_FOUND
+    endif() # DOXYGEN_FOUND
+else()
+    if(BUILD_SHARED_LIBS)
+        install(TARGETS logog LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+    endif()
 endif () # CMAKE_PROJECT_NAME = logog
diff --git a/scripts/cmake/MetisSetup.cmake b/scripts/cmake/MetisSetup.cmake
index 9e2ea36a94e..41677c5243d 100644
--- a/scripts/cmake/MetisSetup.cmake
+++ b/scripts/cmake/MetisSetup.cmake
@@ -23,6 +23,9 @@ include_directories(BEFORE ${METIS_PATH}/libmetis)
 file(GLOB metis_sources ${METIS_PATH}/libmetis/*.c)
 # Build libmetis.
 add_library(metis ${GKlib_sources} ${metis_sources})
+if(BUILD_SHARED_LIBS)
+    install(TARGETS metis LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
+endif()
 
 if(UNIX)
   target_link_libraries(metis m)
-- 
GitLab