<div dir="ltr"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">This seems like something that would be best-suited for a toolchain file<br></blockquote><div><br></div><div>Is a toolchain file not equivalent to the corresponding list of '-D' initializers? (aside from convenience)</div></div><br><div class="gmail_quote"><div dir="ltr">On Tue, Aug 14, 2018 at 1:34 PM Michael Ellery <<a href="mailto:mellery451@gmail.com" target="_blank">mellery451@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">This seems like something that would be best-suited for a toolchain file:<br>
<br>
<a href="https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html" rel="noreferrer" target="_blank">https://cmake.org/cmake/help/latest/manual/cmake-toolchains.7.html</a><br>
<br>
Have you given that a try? Also, I wonder if STATIC_LIBRARY_FLAGS is a custom setting, because I don’t think that one is a standard cmake variable.<br>
<br>
-Mike<br>
<br>
> On Aug 14, 2018, at 9:30 AM, Irina Chernushina via CMake <<a href="mailto:cmake@cmake.org" target="_blank">cmake@cmake.org</a>> wrote:<br>
> <br>
> Hi,<br>
> <br>
> What is the correct way of setting archiver (and flags) and linker<br>
> (and flags) outside the CMakeLists.txt?<br>
> <br>
> 1) I am trying to use the following pattern:<br>
> <br>
> cmake -DCMAKE_AR="<path-to-ar>" -DCMAKE_CXX_LINK_EXECUTABLE="<linker<br>
> path> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o<br>
> <TARGET> <LINK_LIBRARIES>" -DSTATIC_LIBRARY_FLAGS="<flags>"<br>
> -DCMAKE_SHARED_LINKER_FLAGS="<flags>"<br>
> -DCMAKE_EXE_LINKER_FLAGS="<flags>"<br>
> <br>
> Is that in general correct options to pass that information?<br>
> Judging by documentation, they are.<br>
> <br>
> 2) However, I am getting the following warning:<br>
> CMake Warning:<br>
> Manually-specified variables were not used by the project:<br>
> <br>
> STATIC_LIBRARY_FLAGS<br>
> (Also, in CMakeCache.txt this variable is UNINITIALIZED)<br>
> <br>
> If I am trying to use CMAKE_STATIC_LINKER_FLAGS, I get in the cache:<br>
> <br>
> //Path to a program.<br>
> CMAKE_AR:FILEPATH=/usr/bin/ar<br>
> ...<br>
> //Flags used by the linker during the creation of static libraries.<br>
> CMAKE_STATIC_LINKER_FLAGS:STRING=rcsD<br>
> <br>
> But the link command looks like:<br>
> <br>
> /usr/bin/ar qc libXXX.a rcsD file1.o .. filen.o<br>
> /usr/bin/ranlib libz.a<br>
> <br>
> and I get the error:<br>
> /usr/bin/ar: rcsD: No such file or directory<br>
> <br>
> Because the order of ar arguments is wrong, flags should come before "qc".<br>
> <br>
> Thank you in advance<br>
> Irina<br>
> <br>
> <br>
> Irina Chernushina | Software Developer | <a href="mailto:ichern@google.com" target="_blank">ichern@google.com</a> |<br>
> <br>
> <br>
> Google Germany GmbH<br>
> <br>
> Erika-Mann-Straße 33<br>
> <br>
> 80636 München<br>
> <br>
> <br>
> Geschäftsführer: Paul Manicle, Halimah DeLaine Prado<br>
> <br>
> Registergericht und -nummer: Hamburg, HRB 86891<br>
> <br>
> Sitz der Gesellschaft: Hamburg<br>
> <br>
> <br>
> Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise<br>
> erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes<br>
> weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich<br>
> bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.<br>
> <br>
> <br>
> <br>
> This e-mail is confidential. If you received this communication by<br>
> mistake, please don't forward it to anyone else, please erase all<br>
> copies and attachments, and please let me know that it has gone to the<br>
> wrong person.<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>
<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>