From bdd343bb57899731cc28dc4e13b6e001a6d72e9c Mon Sep 17 00:00:00 2001 From: Andrew Noyes Date: Mon, 11 Nov 2024 12:09:36 -0800 Subject: [PATCH] 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 --- CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 198dae5..e172ee2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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")