Good way to add arguments to CMAKE_STRIP on macOS

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Good way to add arguments to CMAKE_STRIP on macOS

CMake mailing list
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.

--

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake