[libstreams] /: Make commit 695554fb more portable.

Raphael Kubo da Costa kubito at gmail.com
Sat Jun 11 22:14:49 CEST 2011


Git commit 622c6f8fb4072a1b29d5bd4e0276d08c3f3791b3 by Raphael Kubo da Costa.
Committed on 11/06/2011 at 22:08.
Pushed by rkcosta into branch 'master'.

Make commit 695554fb more portable.

As suggested six months ago (!) in the kde-buildsystem mailing list
[1], commit 695554fb will probably not work on non-Unix platforms.

We now use exported targets to define the library path in
LibStreamsConfig.cmake in a way which was based on Alex's buildsystem
example in kdeexamples.

CCMAIL: kde-buildsystem at kde.org

[1] http://lists.kde.org/?l=kde-buildsystem&m=129478121119861&w=2

M  +2    -0    CMakeLists.txt     
M  +5    -1    LibStreamsConfig.cmake.in     
M  +1    -1    lib/CMakeLists.txt     

http://commits.kde.org/libstreams/622c6f8fb4072a1b29d5bd4e0276d08c3f3791b3

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0442631..e673324 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -89,6 +89,8 @@ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/StrigiConfig.cmake
 	DESTINATION ${LIB_DESTINATION}/strigi)
 install(FILES ${CMAKE_CURRENT_BINARY_DIR}/LibStreamsConfig.cmake
 	DESTINATION ${LIB_DESTINATION}/libstreams)
+install(EXPORT StreamsExport FILE LibStreamsTargets.cmake
+        DESTINATION ${LIB_DESTINATION}/libstreams)
 
 # library
 if(NOT WIN32)
diff --git a/LibStreamsConfig.cmake.in b/LibStreamsConfig.cmake.in
index 9d84b14..ccbc176 100644
--- a/LibStreamsConfig.cmake.in
+++ b/LibStreamsConfig.cmake.in
@@ -1,8 +1,12 @@
+get_filename_component(CURRENT_DIRECTORY ${CMAKE_CURRENT_LIST_FILE} PATH)
+
+include(${CURRENT_DIRECTORY}/LibStreamsTargets.cmake)
+
 set(LIBSTREAMS_FOUND TRUE)
 set(LIBSTREAMS_VERSION @LIBSTREAMS_VERSION@)
 set(LIBSTREAMS_INCLUDE_DIRS @CMAKE_INSTALL_PREFIX@/include)
 set(LIBSTREAMS_LIBRARY_DIRS @LIB_DESTINATION@)
-set(LIBSTREAMS_LIBRARIES "${LIBSTREAMS_LIBRARY_DIRS}/libstreams.so")
+set(LIBSTREAMS_LIBRARIES streams)
 
 # Libstreams also define the global strigi version
 set(STRIGI_VERSION_MAJOR @STRIGI_VERSION_MAJOR@)
diff --git a/lib/CMakeLists.txt b/lib/CMakeLists.txt
index 0996601..f2f6cda 100644
--- a/lib/CMakeLists.txt
+++ b/lib/CMakeLists.txt
@@ -56,7 +56,7 @@ set_target_properties(streams PROPERTIES
 	DEFINE_SYMBOL MAKE_STREAMS_LIB
 )
 target_link_libraries(streams ${ZLIB_LIBRARIES} ${BZIP2_LIBRARIES} ${ICONV_LIBRARIES})
-install(TARGETS streams
+install(TARGETS streams EXPORT StreamsExport
 	LIBRARY DESTINATION ${LIB_DESTINATION}
 	RUNTIME DESTINATION bin
 	ARCHIVE DESTINATION ${LIB_DESTINATION}


More information about the Kde-buildsystem mailing list