void-packages/srcpkgs/libaccounts-qt/patches/cross.patch

62 lines
2.8 KiB
Diff

--- a/Accounts/AccountsQt5Config.cmake.in
+++ b/Accounts/AccountsQt5Config.cmake.in
@@ -1,5 +1,25 @@
# ACCOUNTSQT_INCLUDE_DIRS - The libaccounts-qt include directories
# ACCOUNTSQT_LIBRARIES - The libraries needed to use libaccounts-qt
-set(ACCOUNTSQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so)
-set(ACCOUNTSQT_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/AccountsQt5" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(_IMPORT_PREFIX "/usr/lib/cmake/AccountsQt5")
+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(ACCOUNTSQT_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(ACCOUNTSQT_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)
+set(ACCOUNTSQT5_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(ACCOUNTSQT5_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)
--- a/Accounts/AccountsQt6Config.cmake.in
+++ b/Accounts/AccountsQt6Config.cmake.in
@@ -1,5 +1,25 @@
# ACCOUNTSQT_INCLUDE_DIRS - The libaccounts-qt include directories
# ACCOUNTSQT_LIBRARIES - The libraries needed to use libaccounts-qt
-set(ACCOUNTSQT_LIBRARIES $${INSTALL_LIBDIR}/lib$${TARGET}.so)
-set(ACCOUNTSQT_INCLUDE_DIRS $${INSTALL_PREFIX}/include/$${TARGET}/)
\ No newline at end of file
+# 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/AccountsQt6" REALPATH)
+if(_realCurr STREQUAL _realOrig)
+ set(_IMPORT_PREFIX "/usr/lib/cmake/AccountsQt6")
+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(ACCOUNTSQT_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(ACCOUNTSQT_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)
+set(ACCOUNTSQT6_LIBRARIES ${_IMPORT_PREFIX}/lib/lib$${TARGET}.so)
+set(ACCOUNTSQT6_INCLUDE_DIRS ${_IMPORT_PREFIX}/include/$${TARGET}/)