[CMake] Patch CMake for Mac static library creation

Belcourt, K. Noel kbelco at sandia.gov
Fri Nov 4 18:11:45 EDT 2011


On Nov 4, 2011, at 3:56 PM, Belcourt, K. Noel wrote:

> 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?

If I use a custom command like this (physics is the name of the static  
library):

add_custom_command(TARGET physics POST_BUILD COMMAND ranlib -c)

I get this error when it tries to run.

"/usr/bin/ranlib -c" libphysics.a
Error running link command: No such file or directory
make[2]: *** [libs/test/physics/libphysics.a] Error 2

Because the quoted command includes the argument.  Any ideas?

-- Noel

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


More information about the CMake mailing list