[CMake] Simple (?) problem with libraries & executable dependencies

Carminati Federico federico.carminati at cern.ch
Sun Feb 13 19:32:33 EST 2011


Hello,
   I have a problem with the dependencies of an executable. The executable depends on a number of shared libraries. If I define the executable like this


add_executable(aliroot aliroot.cxx)
target_link_libraries(aliroot Mylib)

then the link command really looks like

g++ -o aliroot ../lib/libMylib.so

and I have plenty of problems with relocation and rpaths. If I just do

target_link_libraries(aliroot -lMylib)

the link command looks "right":

g++ -o aliroot -lMylib

however the executable is NOT relinked in case a library is recreated. I even tried to do 

add_dependencies(aliroot <path to the library>/libMylib.so)

but it does not work. Any hint? Thanks!

Federico Carminati
CERN-PH 
1211 Geneva 23
Switzerland
Tel: +41 22 76 74959
Fax: +41 22 76 68505
Mobile: +41 76 487 4843





More information about the CMake mailing list