CMakeLists: fix import of external jansson and utf8cpp #7982
|
@ -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)
|
||||
![]() Normally, jansson is vendored as a 3party and configured with CMake: This will continue to work. A jansson installation of a distribution normally contains (just) a pkgconfig file (it's pretty common). See for example the debian package: https://packages.debian.org/bookworm/amd64/libjansson-dev/filelist
Appearently, CMake's Normally, jansson is vendored as a 3party and configured with CMake:
https://github.com/organicmaps/organicmaps/blob/master/3party/CMakeLists.txt#L35
This will continue to work. A jansson installation of a distribution normally contains (just) a pkgconfig file (it's pretty common). See for example the debian package: https://packages.debian.org/bookworm/amd64/libjansson-dev/filelist
> Why it doesn't find the library without explicit PkgConfig?
Appearently, CMake's `find_package` does not search for pkgconfig files. It needs the `FindPkgConfig` module for that: https://cmake.org/cmake/help/latest/module/FindPkgConfig.html
![]() Does it mean that on Debian/Ubuntu the current master works with PkgConfig for utf8 even without explicitly writing it in cmake? If yes, why? Could it be that cmake detects some pkgconfig vars/files/configs on Debian/Ubuntu, but doesn't do it on Gentoo for some reason? Maybe some env vars are missing? cmake has Does it mean that on Debian/Ubuntu the current master works with PkgConfig for utf8 even without explicitly writing it in cmake? If yes, why? Could it be that cmake detects some pkgconfig vars/files/configs on Debian/Ubuntu, but doesn't do it on Gentoo for some reason? Maybe some env vars are missing?
cmake has `--trace` parameter that may be helpful to discover issues with packages.
![]() Do you mean the test pipeline here? Does it build with or without Do you mean the test pipeline here? Does it build with or without `WITH_SYSTEM_PROVIDED_3PARTY`?
![]()
It's not past tense, it is present. It is still working with > How did it work on other systems without explicit PkgConfig specification?
It's not past tense, it is present. It is still working with `WITH_SYSTEM_PROVIDED_3PARTY` perfectly fine, if one installs the latest release of jansson on a system. The `find_package` is looking for `janssonConfig.cmake` first, and that is by default installed to `/usr/local/lib/cmake/jansson/` if you install from source.
|
||||
|
||||
find_package(expat CONFIG REQUIRED)
|
||||
find_package(jansson CONFIG REQUIRED)
|
||||
find_package(pugixml REQUIRED)
|
||||
find_package(utf8cpp REQUIRED)
|
||||
endif()
|
||||
|
|
How did it work on other systems without explicit PkgConfig specification? Will it continue to work? Why it doesn't find the library without explicit PkgConfig?
CC @Ferenc-