[CMake] Project being (unnecessarily) relinked

Bill Hoffman bill.hoffman at kitware.com
Wed Sep 12 08:45:52 EDT 2007


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. 
>   
>> Something like this:
>> target_link_libraries(foo optimized /full/path/to/relbuild/bar.lib debug
>> /full/path/to/debugbuild/bar.lib)
>>
>> The odd part is that if you do not use full paths then it should never
>> relink because of a library
>> changing.   Something else is different in your cmakelist file.  Again,
>> please create a complete
>> example that shows the problem.
>>     
>
> I've fixed the problem now. The main culprit was that the path to the
> library I was linking against was only passed to link.exe through a
> -LIBPATH command line option, i.e. using set_target_property(..
> LINK_FLAGS ..). My guess is that this made Visual Studio fail to realize
> that the library was up-to-date (or even existed).
>
>   
That still does not make sense.  If visual studio does not know where 
the library is, then
it will not just rebuild all the time.   I would like to see an example 
that shows this problem,
as I suspect at the end of the day it is most likely a cmake bug.  Can 
you at least send me
the .vcproj and .sln files for a version that has the problem? 

Thanks.

-Bill

>   



More information about the CMake mailing list