Skip to content

Commit f04f94c

Browse files
committed
revert last commit again
1 parent 1df2b07 commit f04f94c

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

cpp/thirdparty/CMakeLists.txt

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,13 @@ if(MEMILIO_USE_BUNDLED_SPDLOG)
3838
if(NOT spdlog_POPULATED)
3939
FetchContent_Populate(spdlog)
4040

41-
# Force static spdlog (wheels stay self-contained)
42-
set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build spdlog as a static library" FORCE)
41+
# Use spdlogs own shared/static switch (SPDLOG_BUILD_SHARED). Default to
42+
# the project setting unless we explicitly want a static lib (e.g. wheels).
43+
if(MEMILIO_PREFER_STATIC_SPDLOG)
44+
set(SPDLOG_BUILD_SHARED OFF CACHE BOOL "Build spdlog as a shared library" FORCE)
45+
elseif(NOT DEFINED SPDLOG_BUILD_SHARED)
46+
set(SPDLOG_BUILD_SHARED ${BUILD_SHARED_LIBS} CACHE BOOL "Build spdlog as a shared library" FORCE)
47+
endif()
4348

4449
add_subdirectory(${spdlog_SOURCE_DIR} ${spdlog_BINARY_DIR} EXCLUDE_FROM_ALL)
4550
endif()

pycode/memilio-simulation/CMakeLists.txt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,3 +173,19 @@ if(TARGET jsoncpp_lib)
173173
DESTINATION lib
174174
)
175175
endif()
176+
177+
if(TARGET spdlog)
178+
get_target_property(_SPDLOG_LIB_TYPE spdlog TYPE)
179+
180+
if(_SPDLOG_LIB_TYPE STREQUAL "SHARED_LIBRARY")
181+
set_target_properties(spdlog PROPERTIES
182+
INSTALL_RPATH "$ORIGIN"
183+
)
184+
install(FILES
185+
$<TARGET_FILE:spdlog>
186+
$<TARGET_SONAME_FILE:spdlog>
187+
$<TARGET_LINKER_FILE:spdlog>
188+
DESTINATION lib
189+
)
190+
endif()
191+
endif()

0 commit comments

Comments
 (0)