[CMake] Remove all rpaths on install

Orion Poplawski orion at cora.nwra.com
Fri Feb 20 14:27:22 EST 2009


Alexander Neundorf wrote:
> On Friday 20 February 2009, Orion Poplawski wrote:
>> We need to make sure that all rpaths are removed on install when
>> building Fedora rpms.  How can we achieve this?  We still see /usr/lib64
>> being added (twice!) to items:
>>
>>
>>   0x000000000000000f (RPATH)              Library rpath:
>> [/usr/lib64:/usr/lib64]
>>
>> Get "/usr/lib:/usr/lib" on 32-bit machines.
>>
>> This is with cmake 2.6.3 RC 13
>>
>> -DINSTALL_RPATH="" (or -DCMAKE_INSTALL_RPATH="" which should it be?)
> 
> It's CMAKE_INSTALL_RPATH. INSTALL_RPATH is the name of the target property, 
> which you can use to override the global setting.
> What you do will not have an effect if:
> -CMAKE_INSTALL_RPATH is set somewhere inside the CMakeLists, this later set() 
> command will override the one given from the command line
> -if INSTALL_RPATH or INSTALL_RPATH_USE_LINK_PATH is set using 
> set_target_properties()

Ah, okay.  The project is using:

if(USE_RPATH)
   set(LIB_INSTALL_RPATH)
   list(APPEND LIB_INSTALL_RPATH ${libdir})
   list(APPEND LIB_INSTALL_RPATH ${PANGO_RPATH})
   set_target_properties(
   LASi
   PROPERTIES
   SOVERSION ${LASi_SOVERSION}
   VERSION ${LASi_VERSION}
   INSTALL_RPATH "${LIB_INSTALL_RPATH}"
   INSTALL_NAME_DIR "${libdir}"
   )
else(USE_RPATH)
   set_target_properties(
   LASi
   PROPERTIES
   SOVERSION ${LASi_SOVERSION}
   VERSION ${LASi_VERSION}
   INSTALL_NAME_DIR "${libdir}"
   )
endif(USE_RPATH)

Turning off "USE_RPATH" worked for this package.  Thanks!

> 
> If there is no explicit RPATH handling in the project, the RPATH will be 
> removed completely from the binaries when installing them by default.
> 
> You should be able to disable RPATH completely by setting the variable 
> CMAKE_SKIP_RPATH to TRUE. This is a cache variable, i.e. you have to set it 
> in the cache.

This is the approach that has been taken so far.  The problem is that it 
breaks build time tests that depend on rpaths to find the compiled but 
not yet installed libraries.

-- 
Orion Poplawski
Technical Manager                     303-415-9701 x222
NWRA/CoRA Division                    FAX: 303-415-9702
3380 Mitchell Lane                  orion at cora.nwra.com
Boulder, CO 80301              http://www.cora.nwra.com


More information about the CMake mailing list