void-packages/srcpkgs/signond/patches/cross.patch

69 lines
3.1 KiB
Diff

diff --git a/lib/SignOn/SignOnQt5Config.cmake.in b/lib/SignOn/SignOnQt5Config.cmake.in
index 128ee8d..bae7705 100644
--- a/lib/SignOn/SignOnQt5Config.cmake.in
+++ b/lib/SignOn/SignOnQt5Config.cmake.in
@@ -2,6 +2,25 @@
# SIGNONQT_LIBRARIES - The libraries needed to use libsignon-qt
# SIGNONQT_LIBRARIES_STATIC - The static version of libsignon-qt
-set(SIGNONQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so)
-set(SIGNONQT_LIBRARIES_STATIC $${INSTALL_LIBDIR}/lib$${TARGET}.a)
-set(SIGNONQT_INCLUDE_DIRS $${INSTALL_PREFIX}/include/$${TARGET})
+# Compute the installation prefix relative to this file.
+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+# Use original install prefix when loaded through a
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr "${_IMPORT_PREFIX}" REALPATH)
+get_filename_component(_realOrig "/usr/lib/cmake/SignOnQt5" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(_IMPORT_PREFIX "/usr/lib/cmake/SignOnQt5")
+endif()
+unset(_realOrig)
+unset(_realCurr)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+if(_IMPORT_PREFIX STREQUAL "/")
+ set(_IMPORT_PREFIX "")
+endif()
+
+set(SIGNONQT_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(SIGNONQT_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)
+set(SIGNONQT_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(SIGNONQT_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)
diff --git a/lib/SignOn/SignOnQt6Config.cmake.in b/lib/SignOn/SignOnQt6Config.cmake.in
index 128ee8d..9222038 100644
--- a/lib/SignOn/SignOnQt6Config.cmake.in
+++ b/lib/SignOn/SignOnQt6Config.cmake.in
@@ -2,6 +2,25 @@
# SIGNONQT_LIBRARIES - The libraries needed to use libsignon-qt
# SIGNONQT_LIBRARIES_STATIC - The static version of libsignon-qt
-set(SIGNONQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so)
-set(SIGNONQT_LIBRARIES_STATIC $${INSTALL_LIBDIR}/lib$${TARGET}.a)
-set(SIGNONQT_INCLUDE_DIRS $${INSTALL_PREFIX}/include/$${TARGET})
+# Compute the installation prefix relative to this file.
+get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+# Use original install prefix when loaded through a
+# cross-prefix symbolic link such as /lib -> /usr/lib.
+get_filename_component(_realCurr "${_IMPORT_PREFIX}" REALPATH)
+get_filename_component(_realOrig "/usr/lib/cmake/SignOnQt6" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(_IMPORT_PREFIX "/usr/lib/cmake/SignOnQt6")
+endif()
+unset(_realOrig)
+unset(_realCurr)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+if(_IMPORT_PREFIX STREQUAL "/")
+ set(_IMPORT_PREFIX "")
+endif()
+
+set(SIGNONQT_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(SIGNONQT_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)
+set(SIGNONQT_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(SIGNONQT_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)