[CMake] Linker error with sub project's static libs

Leif Walsh leif.walsh at gmail.com
Thu Aug 21 14:22:39 EDT 2014


Are your libraries mutually dependent?  You may be hitting the
mutually-dependent static library problem.  Look for the word "mutual" near
the end of
http://www.cmake.org/cmake/help/v3.0/command/target_link_libraries.html,
that section explains some of what is going on.


On Thu, Aug 21, 2014 at 2:19 PM, Olaf Peter <ope-devel at gmx.de> wrote:

> Hello Marcel,
>
>  Olaf,
>>
>> Unless your code snippets are incomplete, I'm missing the following
>> statement in ./source/eea/ui/CMakeLists.txt
>>
>>      target_link_libraries(eea_ui_lib
>>          eea_ui_schematic_lib)
>>
>> I'm not sure this is causing the link error, but it's worth a try.
>>
> thank you a lot, this solves the linker problem - I have to add these
> twice, reference to the other lib each time.
>
>
>> Furthermore, I think the order of add_subdirectory(), add_library(), and
>> target_link_libraries() is important. You might want to check those as
>> well.
>>
> The order matches of course, but I haven't never such linker problems. The
> first time I'm using target_link_lib for a library self. The reason is not
> clear for me. What happens under the hood here?
>
>
> Thanks,
> Olaf
>
> --
>
> Powered by www.kitware.com
>
> Please keep messages on-topic and check the CMake FAQ at:
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Kitware offers various services to support the CMake community. For more
> information on each offering, please visit:
>
> CMake Support: http://cmake.org/cmake/help/support.html
> CMake Consulting: http://cmake.org/cmake/help/consulting.html
> CMake Training Courses: http://cmake.org/cmake/help/training.html
>
> Visit other Kitware open-source projects at http://www.kitware.com/
> opensource/opensource.html
>
> Follow this link to subscribe/unsubscribe:
> http://public.kitware.com/mailman/listinfo/cmake
>



-- 
Cheers,
Leif
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://public.kitware.com/pipermail/cmake/attachments/20140821/05725b1c/attachment.html>


More information about the CMake mailing list