[CMake] How to get stripped Release builds?

Michael Wild themiwi at gmail.com
Tue Aug 3 04:38:07 EDT 2010


On 3. Aug, 2010, at 9:26 , Martin Wodok wrote:

> Thanks D3ck0r,
> 
>> Personally I'd add
>> 
>> set(CMAKE_BUILD_TYPE "Debug" CACHE STRING
>>      "Set build type")
>>  set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
>>               "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
>> 
>> to my root project, and select option release default... or as part of
>> the build.
>> 
>> think -DCMAKE_BUILD_TYPE="Release" on the command line does it
> 
> but does that switch enable stripping of the binary in the Release
> build? I do have a Debug and Release build already, that's not the
> point...
> 
> Cheers!
> Martin

Do you want stripping during build time? That's unusual... Only way I see to do it is to wrap add_executable and add_library in a custom function and add a POST_BUILD custom command and invoke the CMAKE_STRIP tool manually. Only problem I see is to find the output location of the target.

Michael



More information about the CMake mailing list