Hi,

What is the correct way of setting archiver (and flags) and linker
(and flags) outside the CMakeLists.txt?

1) I am trying to use the following pattern:

cmake -DCMAKE_AR="<path-to-ar>" -DCMAKE_CXX_LINK_EXECUTABLE="<linker
path> <FLAGS> <CMAKE_CXX_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o
<TARGET> <LINK_LIBRARIES>" -DSTATIC_LIBRARY_FLAGS="<flags>"
-DCMAKE_SHARED_LINKER_FLAGS="<flags>"
-DCMAKE_EXE_LINKER_FLAGS="<flags>"

Is that in general correct options to pass that information?
Judging by documentation, they are.

2) However, I am getting the following warning:
CMake Warning:
  Manually-specified variables were not used by the project:

    STATIC_LIBRARY_FLAGS
(Also, in CMakeCache.txt this variable is UNINITIALIZED)

If I am trying to use CMAKE_STATIC_LINKER_FLAGS, I get in the cache:

//Path to a program.
CMAKE_AR:FILEPATH=/usr/bin/ar
...
//Flags used by the linker during the creation of static libraries.
CMAKE_STATIC_LINKER_FLAGS:STRING=rcsD

But the link command looks like:

/usr/bin/ar qc libXXX.a rcsD file1.o .. filen.o
/usr/bin/ranlib libz.a

and I get the error:
/usr/bin/ar: rcsD: No such file or directory

Because the order of ar arguments is wrong, flags should come before "qc".

Thank you in advance
Irina


Irina Chernushina | Software Developer | ich...@google.com |


Google Germany GmbH

Erika-Mann-Straße 33

80636 München


Geschäftsführer: Paul Manicle, Halimah DeLaine Prado

Registergericht und -nummer: Hamburg, HRB 86891

Sitz der Gesellschaft: Hamburg


Diese E-Mail ist vertraulich. Falls sie diese fälschlicherweise
erhalten haben sollten, leiten Sie diese bitte nicht an jemand anderes
weiter, löschen Sie alle Kopien und Anhänge davon und lassen Sie mich
bitte wissen, dass die E-Mail an die falsche Person gesendet wurde.



This e-mail is confidential. If you received this communication by
mistake, please don't forward it to anyone else, please erase all
copies and attachments, and please let me know that it has gone to the
wrong person.
-- 

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:
https://cmake.org/mailman/listinfo/cmake

Reply via email to