[CMake] Project being (unnecessarily) relinked
Jesper Eskilson
jesper at eskilson.se
Thu Sep 6 04:46:15 EDT 2007
Mathieu Malaterre wrote:
> On 9/4/07, Jesper Eskilson <jesper at eskilson.se> wrote:
>> Hi!
>>
>> I've got a Visual Studio 8 solution generated by CMake where one of the
>> projects is always being relinked everytime I build it, even when
>> nothing in it has changed (i.e. if I try to build it twice, it always
>> relinks the project the second time).
>>
>> I've studied the build logs, but they do not make me any wiser.
>>
>> Does anyone recognize this behavior?
>
>
> <wild guess>
> Circular dependencie ?
> </wild guess>
>
> I am not sure if outputing the depencie graph with graphiz could show
> that, since it only output high level dep (libs/executable)
I think I've located the problem. The project in question uses
target_link_library() in a possibly non-kosher way:
target_link_library(Foo Bar.lib)
That is, the top-level target Foo should include "Bar.lib" on its
command line. This seems to work insofar that it actually performs the
link correctly, but for some reason it always relinks as well.
A related question: if I include an external project in my solution using
include_external_msproject(Bar ../../Bar/Bar.vcproj)
can I later refer to this project using
target_link_libraries(Foo Bar)
More generally, what is the correct way to specify that a CMake target
should be linked with some external library?
--
/Jesper
More information about the CMake
mailing list