[CMake] Alternatives to INSTALL_RPATH for linking to internal libraries on install

Sam Spilsbury smspillaz at gmail.com
Fri May 14 11:14:02 EDT 2010


Hi,

I'm working for the Compiz project[1] and have just finished
implementing a CMake buildsystem.

Currently, we are linking "plugins" to an executable and various
internal libraries by passing their paths within the build tree to
library_dirs (). While this shows up in the linker command line
correctly, it seems that the libraries don't actually link (upon
inspection with ldd).

The only solution I've found so far is to use something like:

	set_target_properties (
	    ${plugin} PROPERTIES
	    INSTALL_RPATH_USE_LINK_PATH 1
            BUILD_WITH_INSTALL_RPATH 1
            SKIP_BUILD_RPATH 0
	    COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD}"
	    LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD}"
	)

See [2]

and

    set_target_properties (
      ${plugin} PROPERTIES
      INSTALL_RPATH ${CMAKE_INSTALL_PREFIX}/lib
    )

See [3]

Unfortunately, fedora and debian both strictly prohibit the use of
rpath in their packaging guidelines. Is there any way I could get
these libraries to link properly without the use of setting RPATH?

Kind Regards,

Sam.

[1] www.compiz.org
[2] http://git.compiz.org/compiz/core/tree/cmake/CompizPlugin.cmake#n384
[3] http://git.compiz.org/compiz/core/tree/plugins/decor/CMakeLists.txt#n7

-- 
Sam Spilsbury


More information about the CMake mailing list