File tree Expand file tree Collapse file tree 1 file changed +8
-1
lines changed
Expand file tree Collapse file tree 1 file changed +8
-1
lines changed Original file line number Diff line number Diff line change @@ -215,7 +215,14 @@ if (USE_LIBARCHIVE)
215215 if (NOT USE_STANDARD_FILESYSTEM)
216216 message (FATAL_ERROR "Unable to use USE_LIBARCHIVE without USE_STANDARD_FILESYSTEM." )
217217 endif ()
218- use_package(TARGET_NAME LibArchive::LibArchive PACKAGE_NAME LibArchive)
218+ # use either the CMake find module or the pkg-config file to find libarchive; the latter is preferred as the CMake find
219+ # module does not take transitive dependencies into account and thus breaks static linking
220+ option (USE_LIBARCHIVE_VIA_FIND_MODULE "uses the CMake find module to find libarchive" OFF )
221+ if (USE_LIBARCHIVE_VIA_FIND_MODULE)
222+ use_package(TARGET_NAME LibArchive::LibArchive PACKAGE_NAME LibArchive)
223+ else ()
224+ use_pkg_config_module(PKG_CONFIG_MODULES "libarchive" TARGET_NAME LibArchive::LibArchive VISIBILITY PRIVATE )
225+ endif ()
219226 list (APPEND HEADER_FILES io/archive.h)
220227 list (APPEND SRC_FILES io/archive.cpp)
221228 list (APPEND META_PUBLIC_COMPILE_DEFINITIONS ${META_PROJECT_VARNAME} _USE_LIBARCHIVE)
You can’t perform that action at this time.
0 commit comments