Better way than: SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> my_flags ... ?

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Better way than: SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> my_flags ... ?

Marc Herbert
Hi,

1.  I found the hack below in the list's archive. However it seems... hackish. Among others it can't _append_ a flag, it can only replace all flags. Any newer and better way to append some extra flags?

2. Bonus question: how would you query "ar" and append some extra flags *only* when ar/ranlib are new enough to support them?

Thanks in advance,

Marc

SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -qcD <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")


--

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 | Threaded
Open this post in threaded view
|

Re: Better way than: SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> my_flags ... ?

Marc Herbert
Additional issue with this CMAKE_C_ARCHIVE_CREATE hack: it's ignored and reverts back to the default in link.txt when building a "pure assembly" library without any .c file. Adding an empty.c file works around the problem.

Is this expected? Reproduced with CMake 3.13 and 3.14.0.


Le lun. 25 févr. 2019 à 11:41, Marc Herbert <[hidden email]> a écrit :
Hi,

1.  I found the hack below in the list's archive. However it seems... hackish. Among others it can't _append_ a flag, it can only replace all flags. Any newer and better way to append some extra flags?

2. Bonus question: how would you query "ar" and append some extra flags *only* when ar/ranlib are new enough to support them?

Thanks in advance,

Marc

SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -qcD <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")


--

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 | Threaded
Open this post in threaded view
|

Re: Better way than: SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> my_flags ... ?

Marc Herbert

Additional issue with this CMAKE_C_ARCHIVE_CREATE hack: it's ignored and reverts back to the default in link.txt when building a "pure assembly" library without any .c file. Adding an empty.c file works around the problem

Much better than adding an empty .c file: CMAKE_ASM_ARCHIVE_CREATE (resp. CMAKE_CXX_ARCHIVE_CREATE).

Eventually I used:

foreach(lang ASM C CXX)
  SET(CMAKE_${lang}_CREATE_STATIC_LIBRARY

For the more general issue 2. below I filed https://gitlab.kitware.com/cmake/cmake/issues/19474

 
Is this expected? Reproduced with CMake 3.13 and 3.14.0.


Le lun. 25 févr. 2019 à 11:41, Marc Herbert <[hidden email]> a écrit :
Hi,

1.  I found the hack below in the list's archive. However it seems... hackish. Among others it can't _append_ a flag, it can only replace all flags. Any newer and better way to append some extra flags?

2. Bonus question: how would you query "ar" and append some extra flags *only* when ar/ranlib are new enough to support them?

Thanks in advance,

Marc

SET(CMAKE_C_ARCHIVE_CREATE "<CMAKE_AR> -qcD <TARGET> <LINK_FLAGS> <OBJECTS>")
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -D <TARGET>")


--

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