Use llvm-objcopy if using clang and it's available

This works around a weird error I was getting when trying to link a
translation unit that included Internal.h with libconflict-set-static.a
with clang + gnu objcopy
This commit is contained in:
2024-11-11 12:09:36 -08:00
parent 7b31bd5efe
commit bdd343bb57

View File

@@ -36,6 +36,12 @@ add_compile_options(-fdata-sections -ffunction-sections -Wswitch-enum
if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_link_options("-Wno-unused-command-line-argument")
find_program(LLVM_OBJCOPY llvm-objcopy)
if(LLVM_OBJCOPY)
set(CMAKE_OBJCOPY
${LLVM_OBJCOPY}
CACHE FILEPATH "path to objcopy binary" FORCE)
endif()
endif()
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")