[CMake] Linker error with sub project's static libs
Olaf Peter
ope-devel at gmx.de
Fri Aug 22 02:00:01 EDT 2014
Hello Leif,
> 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.
yes it is mutually, ui_lib creates a SchematicView, which is derived
from GraphicView. SchematicView's instance is in ui_schematic_lib, where
GraphicsView is in ui_lib. Probably I should stay the files inside these
directory and add them to the source in ui_lib project as the docs
suggested.
Thanks,
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
>>
>
>
>
More information about the CMake
mailing list