aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseny Kapoulkine <arseny.kapoulkine@gmail.com>2024-03-23 09:44:03 -0700
committerGitHub <noreply@github.com>2024-03-23 09:44:03 -0700
commitf1d8c51ec8e05b571d7f420ce5cb1a6708c5e0ed (patch)
tree23d712ae16ac6fc277a1eec79484418a4766b3dd
parentb2b466403084667c90a0f0cc4e960405cfc8117a (diff)
parent08e38a4c14310fac1ac20e196b12fcc72c7d8077 (diff)
downloadpugixml-f1d8c51ec8e05b571d7f420ce5cb1a6708c5e0ed.zip
pugixml-f1d8c51ec8e05b571d7f420ce5cb1a6708c5e0ed.tar.gz
pugixml-f1d8c51ec8e05b571d7f420ce5cb1a6708c5e0ed.tar.bz2
Merge pull request #611 from kmilos/patch-1
Relative and absolute paths for a relocatable pkgconf file
-rw-r--r--CMakeLists.txt11
-rw-r--r--scripts/pugixml.pc.in4
2 files changed, 13 insertions, 2 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}
diff --git a/scripts/pugixml.pc.in b/scripts/pugixml.pc.in
index 7958774..cfb81f5 100644
--- a/scripts/pugixml.pc.in
+++ b/scripts/pugixml.pc.in
@@ -1,7 +1,7 @@
prefix=@CMAKE_INSTALL_PREFIX@
exec_prefix=${prefix}
-includedir=@CMAKE_INSTALL_FULL_INCLUDEDIR@@INSTALL_SUFFIX@
-libdir=@CMAKE_INSTALL_FULL_LIBDIR@@INSTALL_SUFFIX@
+includedir=@PUGIXML_PC_INCLUDEDIR@
+libdir=@PUGIXML_PC_LIBDIR@
Name: pugixml
Description: Light-weight, simple and fast XML parser for C++ with XPath support.