Am Donnerstag, 5. Mai 2011, 22:21:49 schrieb Dan Furtney:
> I have a CMakelists.txt file that works properly for the “Unix Makefiles”
> type build (Linux) and for VS 2008. When generating a CDT4 project (Linux)
> from the same file, library paths are not resolved and the project won’t
> link. The library paths are specified using the link_directories command
> exclusively.  The cmake files are at the same level as the “Src”
directory
> that contains all source. I am totally stumped as to why this doesn’t work
> under CDT4.

The answer is rather simple: don't use link_directories(). If you use it and
it gives you trouble that means that you don't understand what it does and
that means that you don't need it. Really. Use target_link_libraries() with a
full path to the library you want to use and let CMake do everything else.

Can we please get a big fat warning message into the link_directories()
documentation telling people that if they come from Makefiles or whereever they
should not use this function as this works different than in plain makefiles and
is usually a bad idea to use? I'm often doing support in #cmake on Freenode
and this is likely the most misunderstood concept of everyone coming from
plain Makefiles.

Eike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to