diff --git a/CMakeLists.txt b/CMakeLists.txt index de5b69ca..9acad117 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -287,6 +287,13 @@ if(APPLE OR WIN32) else() set(AL_PC_VERSION_SYMBOL_FLAG " -Wl,--defsym,AL_VER_${PROJECT_VERSION}=0") endif() +# Windows has no runtime search path: DLLs are found through PATH, and MSVC's +# link.exe rejects -rpath +if(WIN32) + set(AL_PC_RPATH_FLAG "") +else() + set(AL_PC_RPATH_FLAG " -Wl,-rpath,\${libdir}") +endif() configure_file(pkgconfig/al-core.pc.in al-core.pc @ONLY) include(GNUInstallDirs) install( diff --git a/cmake/al-coreConfig.cmake.in b/cmake/al-coreConfig.cmake.in index 4d8b30ed..3789cbe1 100644 --- a/cmake/al-coreConfig.cmake.in +++ b/cmake/al-coreConfig.cmake.in @@ -1,7 +1,9 @@ @PACKAGE_INIT@ -include(CMakeFindDependencyMacro) -find_dependency(Boost COMPONENTS filesystem) +# No find_dependency() calls: libal is always a shared library and links its +# dependencies (Boost, HDF5, ...) privately, so consumers don't need them. +# Requiring them would fail where only their runtime libraries are installed +# (e.g. conda environments without libboost-devel). include("${CMAKE_CURRENT_LIST_DIR}/al-coreTargets.cmake") diff --git a/pkgconfig/al-core.pc.in b/pkgconfig/al-core.pc.in index 5a90d4a7..4a1990fb 100644 --- a/pkgconfig/al-core.pc.in +++ b/pkgconfig/al-core.pc.in @@ -8,4 +8,4 @@ Version: @PROJECT_VERSION@ Description: IMAS Access Layer core libraries for C. URL: https://imas.iter.org Cflags: -I${includedir} -Libs: -L${libdir} -lal@AL_PC_VERSION_SYMBOL_FLAG@ -Wl,-rpath,${libdir} +Libs: -L${libdir} -lal@AL_PC_VERSION_SYMBOL_FLAG@@AL_PC_RPATH_FLAG@