[CMake] Project being (unnecessarily) relinked

Dizzy dizzy at roedu.net
Thu Sep 13 02:49:03 EDT 2007


On Wednesday 12 September 2007 15:45:52 Bill Hoffman wrote:
> Jesper Eskilson wrote:
> > Really you should be using full paths to libraries and not
> > LINK_DIRECTORIES anyway.
> >
> >
> > Why not? Is that a general advice about LINK_DIRECTORIES?
>
> Yes, if cmake knows the full path to the library it can handle it much
> better.
> If you just specify the name of the directory and the library cmake does
> not know anything about the library.  But the problem should be the
> opposite of the one you are having.  It should rebuild less than it should
> when link_directories is used.

Sorry to drop in but how portable is this? Right now I too have 
some "convenience libraries" (libraries made with add_library but never 
installed to gather some code and be used from various targets) and to have 
target_link_libraries() "see" them I set first link_directories() to their 
locations. I do this because I worry about the portability of full library 
paths. How do I know what is the full library name on any cmake platform? I 
supose on mingw/gcc it is always libname.a (for a add_library(name ...)) but 
probably with msvc there is another name for it (as add_library() does not 
specify the full name but the "platform independent" name that translates to 
libname.a and so on) and with target_link_libraries() not using full paths 
one also specifies the "platform independent" name of it (just 
target_link_libraries(target name) and not 
target_link_libraries(target /path/to/libname.a)).

What am I missing? :)

Thanks!

-- 
Mihai RUSU					Email: dizzy at roedu.net
GPG : http://dizzy.roedu.net/dizzy-gpg.txt	WWW: http://dizzy.roedu.net
			"Linux is obsolete" -- AST


More information about the CMake mailing list