[CMake] Question about static library linking
Alexander Neundorf
a.neundorf-work at gmx.net
Mon Feb 2 16:56:08 EST 2009
On Monday 02 February 2009, Jonathan Fillion wrote:
> Hi all,
>
>
>
> We're trying to setup cmake to compile our libaries over here and I have
> a simple question that I can't seem to find the answer to.
>
> I have a dynamic library A that depends on a static library B which in
> turns needs another static library C. Now,
>
>
>
> in B's CMakeList.txt:
>
> LINK_DIRECTORIES(/path/to/c)
>
> TARGET_LINK_LIBRARIES(C)
>
>
>
> in A's CMakeList.txt:
>
> LINK_DIRECTORIES(/path/to/b)
>
> TARGET_LINK_LIBRARIES(B)
>
>
>
> When I try to compile A, it does try to link with C (ie, I see '-lC'
> when I put CMake in verbose mode), so it tracks the dependency, but
> unfortunately it does not put C's link path (ie, it misses the
> -L/path/to/c).
>
> Note that 'C' is an external library (libjpeg in this case...).
I think you should use the full path to libjpeg when linking to it for target
C. I.e. either use find_package(JPEG) or find_library() or some other means
to get the full path to the jpeg library.
Alex
More information about the CMake
mailing list