build: various install improvements #1117
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
With this PR I've made two main improvements:
Also, please don't squash this PR on merge, otherwise all the information in the commits will be lost. Thanks :)
Here are the commit messages:
As GLM is a header-only library, its cmake config files should be installed to
share/
(GNUInstallDirs' DATADIR), asshare/
is the canonical directory where architecture-independent files should be stored, whilelib/
is for architecture-dependent stuff (see the FHS).Apart from being technically correct, installing to
share/
can help with cross-compiling, for example in Debian-based environments. If you're interested, I'd suggest reading this thread.I've also made a few minor fixes, like moving GNUInstallDirs in the main CMakeLists.txt so that it is accessible project-wide and removed the unneeded include(CPack) directive.
GLM used to ship a pkg-config file since version 0.9.8.0, added in commit Tachi107@0e018a5, but it was removed together with the install target in commit Tachi107@5f352ec. While the install target was re-added in commit Tachi107@631faff, the .pc file has been left behind.
This patch re-adds it, and, compared to the old one, this pkg-config file also accounts for the cases where GLM is installed in an include directory that is not a subdirectory of the install prefix (i.e. it does the right thing™ when
CMAKE_INSTALL_INCLUDEDIR
is an absolute path).To read why the JoinPaths module is needed, take a look at https://github.com/jtojnar/cmake-snips#concatenating-paths-when-building-pkg-config-files