[CMake] Good way to add arguments to CMAKE_STRIP on macOS
Rafe Hedley
hedley.rafe at yahoo.com
Thu Sep 13 10:47:20 EDT 2018
Hello,
I am trying to override CMAKE_STRIP to do this command:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -x mylib.dylib
so I tried a basic :
set(CMAKE_STRIP "${CMAKE_STRIP} -x")
and
set(CMAKE_STRIP ${CMAKE_STRIP} -x)
Unfortunately, this overriding does not work and there is the final command that I get in cmake_install.cmake :
if(CMAKE_INSTALL_DO_STRIP) execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -x" "$ENV{DESTDIR}/Users/user/mylib.dylib") endif()
or
if(CMAKE_INSTALL_DO_STRIP) execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip;-x" "$ENV{DESTDIR}/Users/user/mylib.dylib") endif()
This does not work and the final command must be :
execute_process(COMMAND "/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip" "-x" "$ENV{DESTDIR}/Users/user/mylib.dylib")
What is the best way to override this ?
I found a really dirty trick that I can add for each target but I don't want to do that:
add_custom_command(TARGET myTarget POST_BUILD COMMAND $<$<CONFIG:Release>:${CMAKE_STRIP}> $<$<CONFIG:Release>:-x> $<$<CONFIG:Release>:$<TARGET_FILE:myTarget>>)
Thank you for your help.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://cmake.org/pipermail/cmake/attachments/20180913/08679085/attachment.html>
More information about the CMake
mailing list