[CMake] link_directories, MSVC and $(Configuration)

Rolf Eike Beer eike at sf-mail.de
Tue Dec 27 10:55:31 EST 2011


Am Dienstag, 27. Dezember 2011, 16:07:46 schrieb Hauke Heibel:
> Hi all,
> 
> I am wondering whether it is intended that the link_directories is
> appending the $(Configuration) sub-directory only to the last
> directory when a list of directories is passed to it?
> 
> I had to write something like
> 
>   foreach(link_dir ${LIBRARY_DIRS})
>     link_directories("${link_dir}")
>   endforeach()
> 
> to override the behaviour.
> 
> Any hint is welcome.

Don't use link_directories. Ever. You don't want to use it. Surely. It does 
not what you think it does. It only exists to create trouble, unexpected 
behaviour and questions to this list ;)

Pass the absolute path of the files you want to link to 
target_link_libraries(). Use the target name if you want to link against a 
library you have built in your project.

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/20111227/e8beddfe/attachment.pgp>


More information about the CMake mailing list