From 4f47d59d1e1fedca49b7341100654989fabbdb6a Mon Sep 17 00:00:00 2001 From: Axel Kohlmeyer Date: Fri, 4 Apr 2025 16:03:11 -0400 Subject: [PATCH] add support for compiling fully static LAMMPS executable with libcurl --- cmake/CMakeLists.txt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index fd76e28941..2b19a609b0 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -518,9 +518,17 @@ endif() find_package(CURL QUIET) option(WITH_CURL "Enable libcurl support" ${CURL_FOUND}) if(WITH_CURL) - find_package(CURL REQUIRED) target_compile_definitions(lammps PRIVATE -DLAMMPS_CURL) - target_link_libraries(lammps PRIVATE CURL::libcurl) + + # need to use pkgconfig for fully static bins to find custom static libs + if (CMAKE_SYSTEM_NAME STREQUAL "LinuxMUSL") + include(FindPkgConfig) + pkg_check_modules(CURL IMPORTED_TARGET libcurl libssl libcrypto) + target_link_libraries(lammps PUBLIC PkgConfig::CURL) + else() + find_package(CURL REQUIRED) + target_link_libraries(lammps PRIVATE CURL::libcurl) + endif() endif() # tweak jpeg library names to avoid linker errors with MinGW cross-compilation