Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CMake is linking againts library's full path

Tags:

build

cmake

Okay I have a project in CMake structured like this:

CMakeLists.txt
/libfoo/CMakeLists.txt
/frontend/qt/CMakeLists.txt

libfoo is a library I'm writing and frontend/qt is a small frontend and also an example of usage. The problem is that CMake passes the relative path to libfoo.so.x to the linker instead of an -l option. The Qt gui target is declared like this:

add_executable(qtgui ${qtgui_sources} ${qtgui_moced} ${qtgui_ui_h})
target_link_libraries(qtgui ${QT_LIBRARIES} foo)

I'd rather it just linked againts -lfoo like all other libs, not the full path. How to do that?

Thank you!

like image 532
kralyk Avatar asked Oct 09 '22 15:10

kralyk


1 Answers

Ah, never mind, found it:

http://www.cmake.org/Wiki/CMake_RPATH_handling

I obviously didn't google enough, sorry.

like image 164
kralyk Avatar answered Oct 12 '22 02:10

kralyk