[CMake] Changing installation prefix triggers re-linking of all libraries
Pere Mato Vila
Pere.Mato at cern.ch
Tue May 3 05:17:22 EDT 2011
> CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
> PROJECT(PREFIX C)
> SET(CMAKE_VERBOSE_MAKEFILE ON)
> ADD_LIBRARY(f SHARED f.c)
> INSTALL(TARGETS f
> RUNTIME DESTINATION bin
> LIBRARY DESTINATION lib
> ARCHIVE DESTINATION lib)
>
> with ${CMAKE_SOURCE_DIR}/f.c containing just "void f(void){}". After
> configuring/building/installing, a reconfiguration with a modified
> CMAKE_INSTALL_PREFIX does not result in recompiling or relinking.
Hi Michael,
In you simple example adding SET(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib") before ADD_LIBRARY(...) does trigger a re-build of the library when changing the length of CMAKE_INSTALL_PREFIX. The reason for this behavior was given by Alex Neundorf:
> Then you set the install RPATH once to "/build/mato/ROOT/install/lib" and then
> to "/build/mato/ROOT/install2/lib", which is one byte longer. So the binary
> has to be created again with one byte more room for the install RPATH.
The fact that the build is re-done because I change the length of the installation destination I would call this a bug and not really a feature.
-------------------------------------------------------------
Pere Mato CERN, PH Department, CH 1211 Geneva 23, Switzerland
e-mail: pere.mato at cern.ch tel: +41 22 76 78696
fax: +41 22 76 68792 gsm: +41 76 48 70855
More information about the CMake
mailing list