Skip to content

pkgconfig integration wrongly rendered if tests are run #2907

@dvzrv

Description

@dvzrv

When running the tests for the project after building it (with -DCMAKE_INSTALL_PREFIX=/usr), the pkgconfig file is rendered with /usr/local/include instead of /usr/include.

What is the issue you have?

When building and running the tests, the CMAKE_INSTALL_PREFIX is not honored when creating the pkgconfig integration.

Please describe the steps to reproduce the issue.

  cmake -DCMAKE_INSTALL_PREFIX='/usr' \
        -DCMAKE_INSTALL_LIBDIR='/usr/lib' \
        -DCMAKE_BUILD_TYPE='None' \
        -DBUILD_TESTING=ON \
        -DJSON_BuildTests=ON \
        -DJSON_MultipleHeaders=ON \
        -Wno-dev \
        -B "build" \
        -S .
  make VERBOSE=1 -C "build"
  make -k test -C "build"
  make DESTDIR="${pkgdir}" install -C build

The pkgconfig integration will contain /usr/local/include, but should include /usr/include.

When building without tests, CMAKE_INSTALL_PREFIX is honored and the pkgconfig file contains /usr/include:

  cmake -DCMAKE_INSTALL_PREFIX='/usr' \
        -DCMAKE_INSTALL_LIBDIR='/usr/lib' \
        -DCMAKE_BUILD_TYPE='None' \
        -DJSON_MultipleHeaders=ON \
        -Wno-dev \
        -B "build" \
        -S .
  make VERBOSE=1 -C "build"
  make DESTDIR="${pkgdir}" install -C build

Can you provide a small but working code example?

n/a

What is the expected behavior?

CMAKE_INSTALL_PREFIX is always honored. Tests never influence the installed files.

And what is the actual behavior instead?

CMAKE_INSTALL_PREFIX is not honored if tests are run. Running tests influences the installed files.

Which compiler and operating system are you using?

  • Compiler: gcc 11.1.0
  • Operating system: Arch Linux

Which version of the library did you use?

  • latest release version 3.9.1
  • other release - please state the version: ___
  • the develop branch

If you experience a compilation error: can you compile and run the unit tests?

  • yes
  • no - please copy/paste the error message below

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions