[CMake] Project being (unnecessarily) relinked

Bill Hoffman bill.hoffman at kitware.com
Wed Sep 12 07:45:30 EDT 2007


Jesper Eskilson wrote
>
> Well, that turned out to be a little hasty conclusion.
>
> In case of linking with a DLL, having paths to both the dll and import 
> lib in LINK_DIRECTORIES avoids relinking. So far, so good.
>
> However, I still get relinks due to a dependency on a static library. 
> In this case, I'm unable to add the path using LINK_DIRECTORIES since 
> the path is different depending on the configuration. I'm currently 
> adding the path using the LINK_FLAGS_{DEBUG, ...} target property 
> (which probably is the cause of the relinking).
>
Something is really strange here.  I don't understand how this could 
happen.   It would be really good at this
point if you could create a small example project that shows this 
problem and post it so I can take a look.
Really you should be using full paths to libraries and not 
LINK_DIRECTORIES anyway.

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.


-Bill



More information about the CMake mailing list