[CMake] flags for shared/static lib

Fraser Hutchison fraser.hutchison at gmail.com
Tue Jun 12 20:04:09 EDT 2012


I assume they do the same thing too in this case, but I defer to David 
since he works for Kitware and knows the source code, whereas I don't 
and don't :-)


On 13/06/2012 00:56, Totte Karlsson wrote:
>
>
> On 6/12/2012 4:23 PM, Fraser Hutchison wrote:
>> You can use:
>>
>> |set_target_properties(${target}-static PROPERTIES 
>> COMPILE_DEFINITIONS RR_STATIC)|
>>
>
> I got the following tip from D Cole to use
> set_property(TARGET ${target}-static PROPERTY COMPILE_DEFINITIONS 
> RR_STATIC)
>
> I assume set_target_properties will do exactly the same. Actually, 
> set_target_props "looks" better in my context so I'll use that.
>
> Thanks!
>
>> For full details, run:
>>
>> |cmake --help-property COMPILE_DEFINITIONS|
>>
>> Cheers,
>> Fraser.
>>
>>
>> On 12/06/2012 23:39, Totte Karlsson wrote:
>>> Hi,
>>> I have a CMakeLists.txt that creates both a shared and static lib.
>>> In short it looks something like this:
>>>
>>> add_definitions(-DEXPORT_RR)
>>> add_library(${target} SHARED ${rrSources})
>>> add_library(${target}-static STATIC ${rrSources})
>>>
>>>
>>> The problem being that for the static version, the flag
>>> -DRR_STATIC should be defined.
>>>
>>> How can one achieve that?
>>>
>>> -totte
>>>
>>> -- 
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake
>>
>>
> -- 
>
> Powered by www.kitware.com
>
> Visit other Kitware open-source projects at 
> http://www.kitware.com/opensource/opensource.html
>
> Please keep messages on-topic and check the CMake FAQ at: 
> http://www.cmake.org/Wiki/CMake_FAQ
>
> Follow this link to subscribe/unsubscribe:
> http://www.cmake.org/mailman/listinfo/cmake




More information about the CMake mailing list