Skip to content

[Bug]: Is pkg-config file relocatable? #219

@t00sa

Description

@t00sa

What happened?

The package config file generated by Vernier includes absolute paths that point to the install locations. These are set when CMake is first run and will either point to the default GNUInstallVars path or the value of the --install-prefix command line argument, e.g.

libdir=@CMAKE_INSTALL_FULL_LIBDIR@
includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@

Libs: -L${libdir} -lvernier -lvernier_c -lvernier_f
Cflags: -I${includedir}

This means that setting --prefix with cmake --install will result in mismatched paths. It also means that the install cannot be easily relocated because the paths are absolute. One solution to this would be to change the variables to use ${pcfiledir} which expands to the directory containing the .pc file and which can be used with relative paths to make the installation relocatable, e.g.

libdir=${pcfiledir}/../
includedir=${pcfiledir}/../../@CMAKE_INSTALL_INCLUDEDIR@

This doesn't appear to be a problem if Vernier is installed with spack - presumably because spack edits the hardwired paths as one of its install actions.

Version

main

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions