Skip to content

Fix cmake/pkgconfig install directories#343

Open
kirelagin wants to merge 3 commits intoemil-e:masterfrom
kirelagin:kelagin/installdir
Open

Fix cmake/pkgconfig install directories#343
kirelagin wants to merge 3 commits intoemil-e:masterfrom
kirelagin:kelagin/installdir

Conversation

@kirelagin
Copy link

Fix and clean up the CMake config and the generated .pc file. This is necessary, in particular, in situations when the .so library and the headers are installed into different prefix directories.

The header files were installed into `${CMAKE_INSTALL_INCLUDEDIR}`
(correct), but the exported target was using a hardcoded `include` path
for its headers location in its install interface.

Set the directory in the target’s interface to where the headers are
actually being installed.

This will result in the exact same behaviour as before, if
`${CMAKE_INSTALL_INCLUDEDIR}` is not overriden, as it defaults to
`include`. However, when it was overriden, the resulting CMake config
was unusable, and this fixes it.
The .pc file was using hardcoded installdir and libdir locations, even
though the headers were actually installed into their respective GNU
dirs, which can be overriden by the user.

Use the appropriate variables instead of the harcoded paths, and also
clean up the file a bit to remove an extra layer of unnecessary
variables in the CMake file.
Previously, the CMake config files for the package were installed into
`share/cmake`. This location is usually reserved for CMake-specific
modules/macros etc.

Install to `lib/cmake` instead, to be consistent with the location of
the `.pc` file, and also switch to using the corresponding GNU libdir
variable.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant