[CMake] Patch CMake for Mac static library creation

Belcourt, K. Noel kbelco at sandia.gov
Fri Nov 4 17:56:13 EDT 2011


Hi,

This is a long overdue followup.

On Dec 4, 2010, at 12:10 PM, Belcourt, K. Noel wrote:

> On Dec 4, 2010, at 10:08 AM, Ryan Pavlik wrote:
>
>> You can configure this for your project:
>> http://www.cmake.org/cmake/help/cmake-2-8- 
>> docs.html#prop_tgt:STATIC_LIBRARY_FLAGS

STATIC_LIBRARY_FLAGS are passed to the archiver.  On the Mac, I need  
to run ranlib after ar runs, and pass flags (-c) to ranlib.  Another  
other ideas how to achieve this?

Thanks.

-- Noel

> This doesn't seem to do what I want it to.  In my CMakeLists.txt  
> file I have this code.
>
> ADD_LIBRARY(modules ${SRCS})
> set_target_properties(modules PROPERTIES static_library_flags "-noel")
>
> but my bogus option never appears anywhere, and I am creating a  
> static archive library for this target.  Also, it seems this flag is  
> geared more to passing flags to ar, not to ranlib (at least there's  
> been some discussion about using it to pass -X 64 to ar on AIX).
>
> Note that I've also tried this approach.
>
>   -D CMAKE_RANLIB:FILEPATH="/usr/bin/ranlib -c"
>
> resulting in this error.
>
> "/usr/bin/ranlib -c" libmodules.a
> Error running link command: No such file or directory
> make[2]: *** [Modules/libmodules.a] Error 2
>
> Naturally omitting the quotes silently drops the -c option.
>
> -- Noel
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20111104/33cdbc9e/attachment.htm>


More information about the CMake mailing list