diff options
author | Miloš Komarčević <4973094+kmilos@users.noreply.github.com> | 2024-03-22 14:05:43 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-03-22 14:05:43 +0100 |
commit | 08e38a4c14310fac1ac20e196b12fcc72c7d8077 (patch) | |
tree | 23d712ae16ac6fc277a1eec79484418a4766b3dd | |
parent | 6ab3fa418b2b49c8a6d41c71c70f57a9c874ba2b (diff) | |
download | pugixml-08e38a4c14310fac1ac20e196b12fcc72c7d8077.zip pugixml-08e38a4c14310fac1ac20e196b12fcc72c7d8077.tar.gz pugixml-08e38a4c14310fac1ac20e196b12fcc72c7d8077.tar.bz2 |
Relative and absolute paths for a relocatable pkgconf file
-rw-r--r-- | CMakeLists.txt | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 1a2beaa..c04fa8a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -192,6 +192,17 @@ if (PUGIXML_USE_POSTFIX) endif() endif() +# Handle both relative and absolute paths (e.g. NixOS) for a relocatable package +if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}") + set(PUGIXML_PC_INCLUDEDIR "${CMAKE_INSTALL_INCLUDEDIR}") +else() + set(PUGIXML_PC_INCLUDEDIR "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}") +endif() +if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}") + set(PUGIXML_PC_LIBDIR "${CMAKE_INSTALL_LIBDIR}") +else() + set(PUGIXML_PC_LIBDIR "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}") +endif() configure_file(scripts/pugixml.pc.in pugixml.pc @ONLY) export(TARGETS ${install-targets} |