Skip to content

Commit

Permalink
Relative and absolute paths for a relocatable pkgconf file
Browse files Browse the repository at this point in the history
  • Loading branch information
kmilos authored Mar 22, 2024
1 parent 6ab3fa4 commit 08e38a4
Showing 1 changed file with 11 additions and 0 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

0 comments on commit 08e38a4

Please sign in to comment.