1 # Because compiler-rt spends a lot of time setting up custom compile flags,
2 # define a handy helper function for it. The compile flags setting in CMake
3 # has serious issues that make its syntax challenging at best.
4 function(set_target_compile_flags target)
6 set(argstring "${argstring} ${arg}")
8 set_property(TARGET ${target} PROPERTY COMPILE_FLAGS "${argstring}")
11 function(set_target_link_flags target)
13 set(argstring "${argstring} ${arg}")
15 set_property(TARGET ${target} PROPERTY LINK_FLAGS "${argstring}")
18 # Check if a given flag is present in a space-separated flag_string.
19 # Store the result in out_var.
20 function(find_flag_in_string flag_string flag out_var)
21 string(REPLACE " " ";" flag_list ${flag_string})
22 list(FIND flag_list ${flag} flag_pos)
23 if(NOT flag_pos EQUAL -1)
24 set(${out_var} TRUE PARENT_SCOPE)
26 set(${out_var} FALSE PARENT_SCOPE)