[CMake] Changing installation prefix triggers re-linking of all libraries

Pere Mato Vila Pere.Mato at cern.ch
Fri Apr 29 09:39:18 EDT 2011


Perhaps somebody can give me some hints on this problem I have. I build a project and install it in <path>/install with "make install".  Then I do change the installation prefix with 
 cmake -DCMAKE_INSTALL_PREFIX=<path>/install2 ../root_cmake/
and if I execute again "make install" it rebuilds basically every library of the project.  I have traced the dependency to the generated link.txt file, which contains the link command. In one case the contents of the file is: 

/usr/bin/c++  -fPIC  -pipe -m64 -Wall -W -Woverloaded-virtual -fPIC -O2 -g  -shared -Wl,-soname,libCint.so -o ../../lib/libCint.so CMakeFiles/Cint.dir/src/loadfile.o ../../lib/libCint_static.a -lpthread -Wl,-rpath,:::::::::::::::::::::::::::: 

and in the other is:

/usr/bin/c++  -fPIC  -pipe -m64 -Wall -W -Woverloaded-virtual -fPIC -O2 -g  -shared -Wl,-soname,libCint.so -o ../../lib/libCint.so CMakeFiles/Cint.dir/src/loadfile.o ../../lib/libCint_static.a -lpthread -Wl,-rpath,::::::::::::::::::::::::::::: 

Notice the different number of colons in the -rpath settings. The first question I have is what is the origin of these many colons in the rpath settings? The second question, why is different when I choose another installation directory. My CMake variables that control RPATH are the following:

first 

CMAKE_INSTALL_RPATH -->/build/mato/ROOT/install/lib
CMAKE_INSTALL_RPATH_USE_LINK_PATH -->TRUE
CMAKE_SKIP_BUILD_RPATH -->FALSE
CMAKE_BUILD_WITH_INSTALL_RPATH -->FALSE

and later 

CMAKE_INSTALL_RPATH -->/build/mato/ROOT/install2/lib
CMAKE_INSTALL_RPATH_USE_LINK_PATH -->TRUE
CMAKE_SKIP_BUILD_RPATH -->FALSE
CMAKE_BUILD_WITH_INSTALL_RPATH -->FALSE

-------------------------------------------------------------
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