Hi all,

as the title already says it, this patch makes the pathes saved in StrigiConfig.cmake relative. This should not be a problem on Linux as pathes are unlikely to change between machines (which is possible on Windows). The patch should work even with a LIB_DESTINATION different than CMAKE_INSTALL_PREFIX/lib.

So my question is:
Can you review the patch and check if it is working?

thanks in advance,
Patrick

--
web:                 http://windows.kde.org
mailing list:        [email protected]
irc:                 #kde-windows (irc.freenode.net)
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt	(revision 913860)
+++ CMakeLists.txt	(working copy)
@@ -244,9 +244,15 @@
 # information needed by users of strigi: version number, include directory, 
 # libraries, API-type (signed or unsigned char), etc.
 # If more things become necessary, add them to StrigiConfig.cmake.in.
+# Please make sure that pathes in the file are set relative to the location of the
+# StrigiConfig.cmake file
 # The installed file will then be loaded by the FIND_PACKAGE(Strigi NO_MODULES)
 # call in kdelibs/cmake/modules/FindStrigi.cmake. Alex
 
+get_filename_component(_LIBRARY_ROOT "${LIB_DESTINATION}" PATH)
+file(RELATIVE_PATH LIBRARY_DESTINATION ${_LIBRARY_ROOT} ${LIB_DESTINATION})
+file(RELATIVE_PATH INCLUDE_DESTINATION ${_LIBRARY_ROOT} ${CMAKE_INSTALL_PREFIX}/include)
+
 configure_file(StrigiConfig.cmake.in ${CMAKE_CURRENT_BINARY_DIR}/StrigiConfig.cmake @ONLY )
 
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/StrigiConfig.cmake DESTINATION ${LIB_DESTINATION}/strigi)
Index: StrigiConfig.cmake.in
===================================================================
--- StrigiConfig.cmake.in	(revision 913860)
+++ StrigiConfig.cmake.in	(working copy)
@@ -22,9 +22,15 @@
 set(STRIGI_NEEDS_CHAR FALSE)
 message(STATUS "Strigi API needs 'signed char'")
 
+# get path of this file and go three levels up (this is equivalent to
+# the CMAKE_INSTALL_PREFIX if LIB_DESTINATION is not set)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+GET_FILENAME_COMPONENT(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
+
 # install locations
-set(STRIGI_INCLUDE_DIR "@CMAKE_INSTALL_PREFIX@/include")
-set(STRIGI_LIBRARY_DIR "@LIB_DESTINATION@")
+set(STRIGI_INCLUDE_DIR "${_IMPORT_PREFIX}/@INCLUDE_DESTINATION@")
+set(STRIGI_LIBRARY_DIR "${_IMPORT_PREFIX}/@LIBRARY_DESTINATION@")
 
 # find the full path to the libraries
 
_______________________________________________
Kde-buildsystem mailing list
[email protected]
https://mail.kde.org/mailman/listinfo/kde-buildsystem

Reply via email to