diff --git a/CMakeLists.txt b/CMakeLists.txt index ec120f7002..cb793dd0d9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -281,6 +281,8 @@ set(ESPRESSO_INSTALL_BINDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_BINDIR}") # folder for C++ and CUDA shared objects set(ESPRESSO_INSTALL_LIBDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}") +set(ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}") + # python site-packages, can be overriden with CMake options if(ESPRESSO_BUILD_WITH_PYTHON) if(NOT ESPRESSO_INSTALL_PYTHON) @@ -349,11 +351,12 @@ if(ESPRESSO_BUILD_WITH_GSL) endif() if(ESPRESSO_BUILD_WITH_STOKESIAN_DYNAMICS) - set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}") FetchContent_GetProperties(stokesian_dynamics) set(STOKESIAN_DYNAMICS 1) if(NOT stokesian_dynamics_POPULATED) + set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}") FetchContent_MakeAvailable(stokesian_dynamics) + set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR}") endif() endif() @@ -461,7 +464,8 @@ set(CMAKE_INSTALL_RPATH "${ESPRESSO_INSTALL_LIBDIR}") # # drop 'lib' prefix from all libraries -set(CMAKE_SHARED_LIBRARY_PREFIX "") +set(ESPRESSO_SHARED_LIBRARY_PREFIX "") +set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}") add_library(espresso_coverage_flags INTERFACE) add_library(espresso::coverage_flags ALIAS espresso_coverage_flags) @@ -684,9 +688,11 @@ if(ESPRESSO_BUILD_WITH_WALBERLA) endif() set(WALBERLA_BUILD_WITH_FASTMATH off CACHE BOOL "") if(NOT walberla_POPULATED) - set(BUILD_SHARED_LIBS OFF) + set(BUILD_SHARED_LIBS ON) + set(CMAKE_SHARED_LIBRARY_PREFIX "libwalberla_") FetchContent_MakeAvailable(walberla) set(BUILD_SHARED_LIBS ${ESPRESSO_BUILD_SHARED_LIBS_DEFAULT}) + set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}") endif() set(WALBERLA_LIBS walberla::core walberla::domain_decomposition walberla::blockforest @@ -704,13 +710,10 @@ if(ESPRESSO_BUILD_WITH_WALBERLA) add_library(${target_w_namespace} ALIAS ${target_wo_namespace}) get_target_property(target_type ${target_wo_namespace} TYPE) if(${target_type} STREQUAL "SHARED_LIBRARY") - install( - TARGETS ${target_wo_namespace} - LIBRARY DESTINATION ${ESPRESSO_INSTALL_PYTHON}/espressomd/_walberla) + install(TARGETS ${target_wo_namespace} + LIBRARY DESTINATION "${ESPRESSO_INSTALL_LIBDIR}") endif() endforeach() - set(CMAKE_INSTALL_RPATH - "${CMAKE_INSTALL_RPATH}:${ESPRESSO_INSTALL_PYTHON}/espressomd/_walberla") if(ESPRESSO_BUILD_WITH_WALBERLA_AVX) function(espresso_avx_flags_callback COMPILER_AVX2_FLAG) target_compile_options( @@ -731,8 +734,12 @@ if(ESPRESSO_BUILD_WITH_CALIPER) set(CALIPER_INSTALL_HEADERS off CACHE BOOL "") if(NOT caliper_POPULATED) set(BUILD_SHARED_LIBS ON) + set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_INSTALL_LIBDIR}") + set(CMAKE_SHARED_LIBRARY_PREFIX "lib") FetchContent_MakeAvailable(caliper) set(BUILD_SHARED_LIBS ${ESPRESSO_BUILD_SHARED_LIBS_DEFAULT}) + set(CMAKE_INSTALL_LIBDIR "${ESPRESSO_OLD_CMAKE_INSTALL_LIBDIR}") + set(CMAKE_SHARED_LIBRARY_PREFIX "${ESPRESSO_SHARED_LIBRARY_PREFIX}") endif() target_compile_options(caliper-common PRIVATE $<$:-Wno-restrict>)