library dependency implementation

Alexander Neundorf neundorf at kde.org
Wed Oct 26 19:23:24 CEST 2005


On Tuesday 25 October 2005 20:39, Ralf Habacker wrote:
...
> > It has the side effect that if you have e.g. the executable
> > "kdevelop" and the library "libkdevelop.so" both will be called simply
> > "kdevelop" on cmake level.
>
> And how does cmake knows in which path the library libkdevelop.so is
> located in a platform independent way ?

Do you mean when building kdevelop or when build something else which should 
link to libkdevelop.so ?

In the first case, it "knows" that the kdevelop library (libkdevelop.so) is a 
target in the project, and so it knows in which directory it is located (and 
that it has to build it before it builds something which wants to link to 
it).

In the second case, there has to be e.g. a FindKDevelop.cmake, which has to be 
included in the own CMakeLists.txt, and which would search for the kdevelop 
libraries in the platform specific directories. FindKDevelop.cmake would then 
set something like KDEVELOP_INC_DIR, KDEVELOP_LIB_DIR and KDEVELOP_LIBRARIES 
to the appropriate values and you have to to use them like this:

include_directories(${KDEVELOP_INC_DIR})
link_directories(${KDEVELOP_LIB_DIR})

Not 100 % sure at the moment, I would have to check, but I think you can even 
skip the link_directories() command and just say

target_link_libraries(my_part_which_uses_kdevelop ${KDEVELOP_LIBRARIES})

Bye
Alex
-- 
Work: alexander.neundorf at jenoptik.com - http://www.jenoptik-los.de
Home: neundorf at kde.org                - http://www.kde.org
      alex at neundorf.net               - http://www.neundorf.net


More information about the Kde-buildsystem mailing list