How can I pass an argument to ranlib
when compiling a static library with CMake?
I tried:
set_target_properties(myLibrary STATIC_LIBRARY_FLAGS "--plugin /usr/lib/gcc/x86_64-linux-gnu/4.9/liblto_plugin.so")
and this worked for ar
but not for the subsequent ranlib
command.
Have you tried this?
SET(CMAKE_C_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
SET(CMAKE_CXX_ARCHIVE_FINISH "<CMAKE_RANLIB> -no_warning_for_no_symbols -c <TARGET>")
On the Mac, this is how I pass the "-no_warning_for_no_symbols" flag to ranlib.
Note: The SET commands don't modify the ranlib command used as part of an installation by running "make install." CMake's installer code does not generate installation scripts that allow for options to be added to ranlib.
Adding
set_property(
TARGET myLibrary
APPEND
PROPERTY STATIC_LIBRARY_FLAGS "-no_warning_for_no_symbols"
)
worked for me.