CMakeLists: import jansson with pkgconfig

Upstream jansson offers compiling with autotools and CMake.
If it is compiled with autotools (the recommended way) it does only
provide a pkgconfig file and not a cmake file.
This is also the way most distributions provide jansson, so this commit
changes the behavior to use pkgconfig, too.

Signed-off-by: Gerion Entrup <gerion.entrup@flump.de>
This commit is contained in:
Gerion Entrup 2024-04-25 10:14:41 +02:00
parent 751e876818
commit 905b161487

View file

@ -320,8 +320,11 @@ if (WITH_SYSTEM_PROVIDED_3PARTY)
set(GFLAGS_USE_TARGET_NAMESPACE ON)
find_package(gflags REQUIRED)
find_package(PkgConfig)
pkg_check_modules(jansson REQUIRED IMPORTED_TARGET jansson)
add_library(jansson::jansson ALIAS PkgConfig::jansson)
find_package(expat CONFIG REQUIRED)
find_package(jansson CONFIG REQUIRED)
find_package(pugixml REQUIRED)
find_package(utf8cpp REQUIRED)
endif()