StripDebugSymbols.cmake 1.3 KB

123456789101112131415161718192021222324252627282930
  1. #
  2. # Copyright (c) Contributors to the Open 3D Engine Project.
  3. # For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. #
  5. # SPDX-License-Identifier: Apache-2.0 OR MIT
  6. #
  7. #
  8. if(${CMAKE_ARGC} LESS 5)
  9. message(FATAL_ERROR "StripDebugSymbols script called with the wrong number of arguments: ${CMAKE_ARGC}")
  10. endif()
  11. # cmake command arguments (not including the first 2 arguments of '-P', 'StripDebugSymbols.cmake')
  12. set(LLVM_STRIP_TOOL ${CMAKE_ARGV3}) # LLVM_STRIP_TOOL : The location of the llvm strip tool (e.g. <ndk-root>/toolchains/llvm/prebuilt/windows-x86_64/bin/llvm-strip.exe)
  13. set(STRIP_TARGET ${CMAKE_ARGV4}) # STRIP_TARGET : The built binary to process
  14. set(TARGET_TYPE ${CMAKE_ARGV5}) # TARGET_TYPE : The target type (STATIC_LIBRARY, MODULE_LIBRARY, SHARED_LIBRARY, EXECUTABLE, or APPLICATION)
  15. # This script only supports executables, applications, modules and shared libraries
  16. if (NOT ${TARGET_TYPE} STREQUAL "MODULE_LIBRARY" AND
  17. NOT ${TARGET_TYPE} STREQUAL "SHARED_LIBRARY" AND
  18. NOT ${TARGET_TYPE} STREQUAL "EXECUTABLE" AND
  19. NOT ${TARGET_TYPE} STREQUAL "APPLICATION")
  20. return()
  21. endif()
  22. message(VERBOSE "Stripping debug symbols from ${STRIP_TARGET}")
  23. execute_process(COMMAND ${LLVM_STRIP_TOOL} --strip-debug ${STRIP_TARGET})