0
0
mirror of https://github.com/zeux/pugixml.git synced 2024-12-26 12:41:06 +08:00

Relative and absolute paths for a relocatable pkgconf file

This commit is contained in:
Miloš Komarčević 2024-03-22 14:05:43 +01:00 committed by GitHub
parent 6ab3fa418b
commit 08e38a4c14
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -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}