CMake: Try add library "LZ4::lz4_shared" if "lz4::lz4" is unavailable

Right now this looks like a distro specific problem, but we'll have to see.

Over on Gentoo: with lz4 1.9.3 there is a lz4::lz4 library target, with 1.9.4 it's no longer
mentioned in the cmake files provided by the  package. (/usr/lib64/cmake/lz4)

arch and openSUSE have lz4 1.9.4 available so I checked there,
they only have .pc files for pkg-config, so asking for "lz4::lz4" works as usual

MSVC does require "lz4::lz4" to be asked for
This commit is contained in:
Kyle Kienapfel 2022-10-11 13:01:29 -07:00
parent 553be194f6
commit 40af1111c2
1 changed files with 5 additions and 1 deletions

View File

@ -169,7 +169,11 @@ endif()
create_target_directory_groups(common) create_target_directory_groups(common)
target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads) target_link_libraries(common PUBLIC ${Boost_LIBRARIES} fmt::fmt microprofile Threads::Threads)
target_link_libraries(common PRIVATE lz4::lz4) if (TARGET lz4::lz4)
target_link_libraries(common PRIVATE lz4::lz4)
else()
target_link_libraries(common PRIVATE LZ4::lz4_shared)
endif()
if (TARGET zstd::zstd) if (TARGET zstd::zstd)
target_link_libraries(common PRIVATE zstd::zstd) target_link_libraries(common PRIVATE zstd::zstd)
else() else()