Skip to content

Commit

Permalink
Merge pull request zeux#611 from kmilos/patch-1
Browse files Browse the repository at this point in the history
Relative and absolute paths for a relocatable pkgconf file
  • Loading branch information
zeux authored Mar 23, 2024
2 parents b2b4664 + 08e38a4 commit f1d8c51
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
4 changes: 2 additions & 2 deletions scripts/pugixml.pc.in
Original file line number Diff line number Diff line change
@@ -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.
Expand Down

0 comments on commit f1d8c51

Please sign in to comment.