From 06c5c0534cb16e3714f1bac70ae3d5820e949330 Mon Sep 17 00:00:00 2001 From: Oliver Lantwin Date: Thu, 4 Jun 2026 16:33:21 +0200 Subject: [PATCH] feat(build): default BUILD_SHARED_LIBS to ON Every subsystem (Cavern, Target, MuonShield, Magnet, DecayVolume, Trackers, Calorimeter, UpstreamTagger, TimingDetector) plus the main SHiPGeometry library uses bare add_library( src/...) without an explicit SHARED. Without BUILD_SHARED_LIBS=ON in the configure, CMake default behaviour produces static archives in lib/, which silently breaks downstream packagers and consumers that assume shared libs. Default BUILD_SHARED_LIBS to ON via option() so the shared library behaviour the rest of the project (and downstream SHiPGeometryService and aegir) clearly expects is what you get out of the box. Users who want static can still pass -DBUILD_SHARED_LIBS=OFF explicitly. --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 88ea9dd..826fb25 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -16,6 +16,8 @@ set(CMAKE_CXX_STANDARD 23) set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_EXTENSIONS OFF) +option(BUILD_SHARED_LIBS "Build shared libraries by default" ON) + # Find GeoModel packages find_package(GeoModelCore REQUIRED) find_package(GeoModelIO REQUIRED)