[CMake][compiler-rt] Use COMPILE_OPTIONS and LINK_OPTIONS

This avoids the need for string-ification and lets CMake deduplicate
potentially duplicate flags.

Differential Revision: https://reviews.llvm.org/D122750
This commit is contained in:
Petr Hosek 2022-03-30 10:33:40 -07:00
parent e1567e771b
commit d47565ed62

View File

@ -5,19 +5,11 @@ include(CheckSymbolExists)
# define a handy helper function for it. The compile flags setting in CMake
# has serious issues that make its syntax challenging at best.
function(set_target_compile_flags target)
set(argstring "")
foreach(arg ${ARGN})
set(argstring "${argstring} ${arg}")
endforeach()
set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}")
set_property(TARGET ${target} PROPERTY COMPILE_OPTIONS ${ARGN})
endfunction()
function(set_target_link_flags target)
set(argstring "")
foreach(arg ${ARGN})
set(argstring "${argstring} ${arg}")
endforeach()
set_property(TARGET ${target} PROPERTY LINK_FLAGS "${argstring}")
set_property(TARGET ${target} PROPERTY LINK_OPTIONS ${ARGN})
endfunction()
# Set the variable var_PYBOOL to True if var holds a true-ish string,