[CMake] Generated library location

Rolf Eike Beer eike at sf-mail.de
Sun Mar 4 15:30:21 EST 2012


Am Sonntag, 4. März 2012, 12:55:40 schrieb Kevin Nathan:
> On Sun, 04 Mar 2012 19:50:50 +0100
> 
> Rolf Eike Beer <eike at sf-mail.de> wrote:
> >Am Sonntag, 4. März 2012, 11:28:47 schrieb Kevin Nathan:
> >> ...doing an out-of-source build, my 'old-common' library (which will
> >> eventually be phased out) ends up in ./build/old-common but the
> >> source for prog2 and prog3 all look for it in ./old-common.
> >
> >target_link_libraries(prog2 old-common)
> >target_link_libraries(prog3 old-common)
> 
> Thanks, Eike! That's what I was doing, so your suggestion told me I
> hadn't messed up there and I went looking for the problem a little
> deeper. That's when I found that in the "link_directories" command, in
> two of the CMakeLists.txt files, was pointing to an old dir (from the
> old code) and I hadn't updated it to use the "old-common" dir. (The
> curse of copy/paste when you aren't sure of what you're doing!) Now,
> it's working -- thanks, again!

Remove it altogether. Link_directories() is never needed when linking to a 
target built in the same CMake project. You must only make sure that the 
library is built before the executables.

Eike
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120304/9de2e01a/attachment.pgp>


More information about the CMake mailing list