<div dir="ltr">Thanks for you help.<div><br></div><div>They are really shared lib, not static. I know it sounds weird: it's a python extension which must not link the ${PYTHON_LIBRARY}  (according to official docs; in fact If I do so I get a segmentation fault) but finally in my executable,a sort of custom/home made  ${PYTHON_EXECUTABLE}, I have to link the ${PYTHON_LIBRARY}.</div><div><br></div><div>About the "B;A;ImportedExtLib;B;A" order. I agree too: it SHOULD work.</div><div>Let's say I do:</div><div><br></div><div>target_link_libraries(MyExe B A ImpLib)  </div><div><br></div><div>in command line (make VERBOSE=1) I;m getting</div><div><br></div><div>g++ .... -o MyExe B A ImpLib A</div><div><br></div><div>The last "A" is coming from target_link_libraries(B PUBLIC A) and the linker  is complaining that this last "A" has undefined symbols.</div><div><br></div><div>Thanks.Giorgio.</div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr">Il giorno mar 6 nov 2018 alle ore 06:59 Robert Maynard <<a href="mailto:robert.maynard@kitware.com">robert.maynard@kitware.com</a>> ha scritto:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">You have order dependent static libraries which can be solved by<br>
constructing a cycle. As Bo stated by constructing the cycle<br>
B;A;ImportedExtLib;B;A each library can see each other.<br>
<br>
Looking at your original code example it looks like you are importing<br>
the libraries as SHARED, but I think these are actually static<br>
libraries and should be imported as such so that CMake does the<br>
automatic cycle creation. In general CMake doesn't do cycle creation<br>
for shared libraries as they are not link order dependent.<br>
On Tue, Nov 6, 2018 at 8:51 AM Giorgio Scorzelli <<a href="mailto:scrgiorgio@gmail.com" target="_blank">scrgiorgio@gmail.com</a>> wrote:<br>
><br>
> I read the docs about  LINK_INTERFACE_MULTIPLICITY    too.<br>
> But I'm not in the situation of a "cyclic dependency" so I 'm not sure if it solve my problem.<br>
> In my case (with B A and ImpLib) what would be the syntax?<br>
><br>
> Il giorno mar 6 nov 2018 alle ore 06:30 Robert Maynard <<a href="mailto:robert.maynard@kitware.com" target="_blank">robert.maynard@kitware.com</a>> ha scritto:<br>
>><br>
>> The target_link_libraries has a property called<br>
>> LINK_INTERFACE_MULTIPLICITY that should help you out.<br>
>> <a href="https://cmake.org/cmake/help/v3.13/command/target_link_libraries.html#cyclic-dependencies-of-static-libraries" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/v3.13/command/target_link_libraries.html#cyclic-dependencies-of-static-libraries</a><br>
>><br>
>><br>
>> On Tue, Nov 6, 2018 at 8:24 AM scrgiorgio <<a href="mailto:scrgiorgio@gmail.com" target="_blank">scrgiorgio@gmail.com</a>> wrote:<br>
>> ><br>
>> > Thanks for the help,<br>
>> ><br>
>> > trying this (or any combination):<br>
>> ><br>
>> > target_link_libraries(MyExe B)<br>
>> > target_link_libraries(MyExe A )<br>
>> > target_link_libraries(MyExe ImpLib)<br>
>> ><br>
>> > I get this order:<br>
>> ><br>
>> > 'B;...whatever...;A;ImpLib"<br>
>> ><br>
>> > and the last past is causing the problem. Apparently there is no way to<br>
>> > change the right part (-Wl,--start-group -Wl,--end-groun sometimes work,<br>
>> > sometimes not).<br>
>> > Any advice?<br>
>> ><br>
>> ><br>
>> ><br>
>> ><br>
>> > --<br>
>> > Sent from: <a href="http://cmake.3232098.n2.nabble.com/" rel="noreferrer" target="_blank">http://cmake.3232098.n2.nabble.com/</a><br>
>> > --<br>
>> ><br>
>> > Powered by <a href="http://www.kitware.com" rel="noreferrer" target="_blank">www.kitware.com</a><br>
>> ><br>
>> > Please keep messages on-topic and check the CMake FAQ at: <a href="http://www.cmake.org/Wiki/CMake_FAQ" rel="noreferrer" target="_blank">http://www.cmake.org/Wiki/CMake_FAQ</a><br>
>> ><br>
>> > Kitware offers various services to support the CMake community. For more information on each offering, please visit:<br>
>> ><br>
>> > CMake Support: <a href="http://cmake.org/cmake/help/support.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/support.html</a><br>
>> > CMake Consulting: <a href="http://cmake.org/cmake/help/consulting.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/consulting.html</a><br>
>> > CMake Training Courses: <a href="http://cmake.org/cmake/help/training.html" rel="noreferrer" target="_blank">http://cmake.org/cmake/help/training.html</a><br>
>> ><br>
>> > Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" rel="noreferrer" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
>> ><br>
>> > Follow this link to subscribe/unsubscribe:<br>
>> > <a href="https://cmake.org/mailman/listinfo/cmake" rel="noreferrer" target="_blank">https://cmake.org/mailman/listinfo/cmake</a><br>
</blockquote></div>