From 4826506d4055a215c92a26483e6539263d4dd896 Mon Sep 17 00:00:00 2001
From: lintao <lintao51@gmail.com>
Date: Tue, 22 Dec 2020 23:47:28 +0800
Subject: [PATCH] WIP: add install macros for modules in Detector

---
 Detector/DetCEPCv4/CMakeLists.txt       | 6 ++++++
 Detector/DetCRD/CMakeLists.txt          | 6 ++++++
 Detector/DetDriftChamber/CMakeLists.txt | 6 ++++++
 Detector/DetEcalMatrix/CMakeLists.txt   | 6 ++++++
 Detector/DetSegmentation/CMakeLists.txt | 5 +++++
 5 files changed, 29 insertions(+)

diff --git a/Detector/DetCEPCv4/CMakeLists.txt b/Detector/DetCEPCv4/CMakeLists.txt
index bc2e5d70..cd3e8eee 100644
--- a/Detector/DetCEPCv4/CMakeLists.txt
+++ b/Detector/DetCEPCv4/CMakeLists.txt
@@ -47,3 +47,9 @@ target_include_directories(DetCEPCv4 PUBLIC
 set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
 dd4hep_generate_rootmap(DetCEPCv4)
+
+install(TARGETS DetCEPCv4
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
diff --git a/Detector/DetCRD/CMakeLists.txt b/Detector/DetCRD/CMakeLists.txt
index 21610c5a..cdd7cb13 100644
--- a/Detector/DetCRD/CMakeLists.txt
+++ b/Detector/DetCRD/CMakeLists.txt
@@ -28,3 +28,9 @@ gaudi_add_module(DetCRD
 set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
 dd4hep_generate_rootmap(DetCRD)
+
+install(TARGETS DetCRD
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
diff --git a/Detector/DetDriftChamber/CMakeLists.txt b/Detector/DetDriftChamber/CMakeLists.txt
index 736dc81a..4a609ce2 100644
--- a/Detector/DetDriftChamber/CMakeLists.txt
+++ b/Detector/DetDriftChamber/CMakeLists.txt
@@ -28,3 +28,9 @@ gaudi_add_module(DetDriftChamber
 set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
 dd4hep_generate_rootmap(DetDriftChamber)
+
+install(TARGETS DetDriftChamber
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
diff --git a/Detector/DetEcalMatrix/CMakeLists.txt b/Detector/DetEcalMatrix/CMakeLists.txt
index 5ea62ff4..1eb21d7c 100644
--- a/Detector/DetEcalMatrix/CMakeLists.txt
+++ b/Detector/DetEcalMatrix/CMakeLists.txt
@@ -29,3 +29,9 @@ gaudi_add_module(DetEcalMatrix
 set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
 dd4hep_generate_rootmap(DetEcalMatrix)
+
+install(TARGETS DetEcalMatrix
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
diff --git a/Detector/DetSegmentation/CMakeLists.txt b/Detector/DetSegmentation/CMakeLists.txt
index d13ee57e..4580fba5 100644
--- a/Detector/DetSegmentation/CMakeLists.txt
+++ b/Detector/DetSegmentation/CMakeLists.txt
@@ -27,3 +27,8 @@ set(LIBRARY_OUTPUT_PATH ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
 message(STATUS "LIBRARY_OUTPUT_PATH -> ${LIBRARY_OUTPUT_PATH}")
 dd4hep_generate_rootmap(DetSegmentationPlugin)
 
+install(TARGETS DetSegmentation DetSegmentationPlugin
+  EXPORT CEPCSWTargets
+  RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}" COMPONENT bin
+  LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" COMPONENT shlib
+  COMPONENT dev)
-- 
GitLab