[CMake] add_dependencies has a wrong order?

Steven Van Ingelgem steven at vaningelgem.be
Wed Feb 25 09:22:40 EST 2009


Yes, it has to do something with it...
Because at least when linking under Linux, if I added dlib BEFORE
dlib_httpclient (as is now the case), dlib_httpclient will complain about
undefined symbols.

That's where the add_dependencies would come into play in my honest opinion.
CMake should calculate the order in which to place the libraries to link
with to honour all the calls made in the project. So in my case, place dlib
behind dlib_httpclient.

What you are refering to is not a dependency in linkage, but a dependency in
compilation. This is fine of course, but is not enough when compiling
libraries.


Greetings,
Steven


2009/2/25 Michael Wild <themiwi at gmail.com>

> I think you misunderstand add_dependencies. The command adds a dependency
> of dlib_httpclient on dlib, i.e. dlib_httplclient DEPENDS ON dlib. It has
> nothing to do with the order the libraries appear on the command line when
> you link ${PROJECT_NAME}.
>
> HTH
>
> Michael
>
>
> On 25. Feb, 2009, at 14:15, Steven Van Ingelgem wrote:
>
>  I have:
>> add_dependencies(dlib_httpclient dlib)
>>
>> But in my cmakelists I have:
>> TARGET_LINK_LIBRARIES(${PROJECT_NAME} dlib dlib_httpclient)
>>
>> Conclusion: it will change itself to "bin/libdlib.a
>> bin/libdlib_httpclient.a"
>> instead I would expect "bin/libdlib_httpclient.a bin/libdlib.a" as I told
>> it
>> to add the dependency.
>>
>>
>> Greetings,
>> Steven
>> _______________________________________________
>> 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
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090225/f47be572/attachment.htm>


More information about the CMake mailing list