mirror of
https://github.com/nlohmann/json.git
synced 2026-10-01 12:10:32 +00:00
Fix the Meson CMake target for includedir or datadir outside the prefix
nlohmann_jsonTargets.cmake always prepended the prefix computed from the file's location to includedir. With an absolute includedir outside the prefix (as Nix passes for packages with a separate dev output), this gave "<prefix>//abs/include"; with an absolute datadir outside the prefix, the number of ".." was derived from the absolute path and the prefix resolved to "/". In both cases find_package(nlohmann_json) failed with "Imported target includes non-existent path". Use the absolute include directory in these cases, as CMake's install(EXPORT) does, and check it in CI. Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
@@ -63,6 +63,12 @@ jobs:
|
||||
grep -q 'JSON_USE_GLOBAL_UDLS=0;JSON_DIAGNOSTICS=1' install-options/share/cmake/nlohmann_json/nlohmann_jsonTargets.cmake
|
||||
cmake -S tests/cmake_import/project -B build-import-options -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install-options
|
||||
cmake --build build-import-options
|
||||
- name: Install with Meson and the include directory outside the prefix
|
||||
run: |
|
||||
meson setup build-meson-split --prefix=${{ github.workspace }}/install-split --includedir=${{ github.workspace }}/install-split-dev/include
|
||||
meson install -C build-meson-split
|
||||
cmake -S tests/cmake_import/project -B build-import-split -DCMAKE_PREFIX_PATH=${{ github.workspace }}/install-split
|
||||
cmake --build build-import-split
|
||||
|
||||
ci_infer:
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
Reference in New Issue
Block a user