[Libstreams] 695554f Specify the full path in LIBSTREAMS_LIBRARIES.

Alexander Neundorf neundorf at kde.org
Tue Jan 11 22:24:00 CET 2011


On Saturday 25 December 2010, Raphael Kubo da Costa wrote:
> commit 695554fbfcaeb0fbeb47a9196ced6cbd485b4433
> branch master
> Author: Raphael Kubo da Costa <kubito at gmail.com>
> Date:   Sat Dec 25 02:38:35 2010 -0200
>
>     Specify the full path in LIBSTREAMS_LIBRARIES.
>
>     libstreamsanalyzer's luceneindexer was not linking properly here
>     because libstreams.so's library was not being included in the linker
>     path.
>
>     Apparently, it is recommended [1] to have full paths specified for
>     libraries (find_library does that, for example), and at least Grantlee
>     also does this.
>
>     [1] http://www.mail-archive.com/cmake@cmake.org/msg27695.html
>
>     CCMAIL: kde-buildsystem at kde.org
>
> diff --git a/LibStreamsConfig.cmake.in b/LibStreamsConfig.cmake.in
> index 91bf427..6669b97 100644
> --- a/LibStreamsConfig.cmake.in
> +++ b/LibStreamsConfig.cmake.in
> @@ -2,4 +2,4 @@ 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 streams)
> +set(LIBSTREAMS_LIBRARIES "${LIBSTREAMS_LIBRARY_DIRS}/libstreams.so")

Uh, that doesn't look too good, it hardcodes the "lib" prefix and the ".so" 
suffix. Does that work on Windows ? OSX ? 

How can it be done better:
1.) use exported targets, then this is done automatically. For this the 
targets have to be put into an "export set" (using the EXPORT argument of 
install(TARGET...)), and then this export set has to be installed (using 
install(EXPORT...) ). The installed export-file can then be included by the 
installed LibStreamsConfig.cmake.

or
2.) use something like 
find_library(LIBSTREAMS_LIBRARIES NAMES streams
                                  HINTS ${LIBSTREAMS_LIBRARY_DIRS}
                                  NO_DEFAULT_PATH)
in the installed LibStreamsConfig.cmake

Alex


More information about the Kde-buildsystem mailing list