On 11/14/2011 03:36 PM, Robert Dailey wrote: > On Mon, Nov 14, 2011 at 6:42 AM, Michael Wild <them...@gmail.com > <mailto:them...@gmail.com>> wrote: > > Hi Arun > > Consider LINK_DIRECTORIES to be obsolete and to be avoided at all cost. > > > I don't really agree with this advice. There are circumstances where > link_directories() is absolutely necessary, so advocating to completely > avoid it isn't really a one size fits all scenario.
Pray tell, what scenario would that be? I'm really curious, because I can't think of any... > > What I've done is make sure that link_directories() is called from a > parent level directory, so that all projects inherit the directories. In > cases where you do not have a hierarchy setup like this, then call > link_directories() once with the same directories before each call to > add_executable, add_library, etc. > > Also one unrelated note, but static libraries do not require any > dependencies to be linked in when it is built. You only need your third > party libraries in your shared library or executable that links against > the static library in question. The OP is talking about such a setup a/CMakelists.txt: ---------------- add_library(a STATIC a.c) # a uses foo internally, but doesn't expose this fact in its interface. # clients of a should not need to know about a's implementation details, # which is why we declare this dependency here and let CMake handle the # rest. target_link_libraries(a foo) b/CMakeLists.txt ----------------- add_executable(b b.c) target_link_libraries(b a) Michael -- 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