[CMake] Patch CMake for Mac static library creation

Michael Hertling mhertling at online.de
Fri Nov 4 21:33:21 EDT 2011


On 11/04/2011 11:11 PM, Belcourt, K. Noel wrote:
> 
> 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)

This custom command can't work since you don't provide the library as
argument for ranlib. How exactly does the failing command look alike?

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

Have you tried the VERBATIM flag, yet?

Regards,

Michael


More information about the CMake mailing list