blob: 1f8fe5e3de73e9e8d639217ed0a115ad87f37ed8 [file]
# A stand-in for llvm-strip, run as `cmake -P strip.cmake <options>
# -o <output> <input>`, that writes the options it was given to the output.
set(options)
math(EXPR last "${CMAKE_ARGC} - 1")
set(i 3)
while(i LESS_EQUAL last)
if(CMAKE_ARGV${i} STREQUAL "-o")
math(EXPR i "${i} + 1")
set(output "${CMAKE_ARGV${i}}")
math(EXPR i "${i} + 1")
set(input "${CMAKE_ARGV${i}}")
else()
list(APPEND options "${CMAKE_ARGV${i}}")
endif()
math(EXPR i "${i} + 1")
endwhile()
if(NOT EXISTS "${input}")
message(FATAL_ERROR "No input '${input}'")
endif()
file(WRITE "${output}" "stripped ${options}\n")