<div dir="ltr">I think both 'extract to common' and '<span style="font-size:12.8px">fifth copy' would be fine here, up to you. </span></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 25, 2017 at 1:42 PM, George Karpenkov <span dir="ltr"><<a href="mailto:ekarpenkov@apple.com" target="_blank">ekarpenkov@apple.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word">Good day,<div><br></div><div>As part of a project of moving libFuzzer to compiler-rt I am trying to port libFuzzer tests to the new system.</div><div>I have a question about CMake structure for sanitizer tests:</div><div>compilation macros across different sanitizers are structured in almost-the-same-but-not-quite-<wbr>way.</div><div>For instance, across tsan/msan/asan/xray we have:</div><div><br></div><div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(95,95,95);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 1 </span><span style="font-kerning:none"># tsan_compile(obj_list, source, arch, {headers})</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(255,135,0);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 2 </span><span style="color:rgb(215,0,95)"><b>macro</b></span><span style="font-kerning:none">(tsan_compile obj_list source arch)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(215,0,95);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 3 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>get_filename_component</b></span><span style="color:rgb(255,135,0)">(<wbr>basename </span><span style="color:rgb(95,215,255)">${source}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">NAME</span><span style="color:rgb(255,135,0)">)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(95,215,255);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 4 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(output_obj </span><span style="color:rgb(175,175,135)">"</span><span style="font-kerning:none">${basename}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${arch}</span><span style="color:rgb(175,175,135)">.o"</span><span style="color:rgb(255,135,0)">)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(208,208,208);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 5 </span><span style="font-kerning:none">  get_target_flags_for_arch</span><span style="color:rgb(255,135,0)">(</span><span style="color:rgb(95,215,255)">${<wbr>arch}</span><span style="color:rgb(255,135,0)"> TARGET_CFLAGS)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(95,215,255);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 6 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(COMPILE_DEPS </span><span style="font-kerning:none">${TSAN_RTL_HEADERS}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${ARGN}</span><span style="color:rgb(255,135,0)">)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(255,135,0);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 7 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>if</b></span><span style="font-kerning:none">(</span><span style="color:rgb(215,0,95)">NOT</span><span style="font-kerning:none"> COMPILER_RT_STANDALONE_BUILD)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(255,135,0);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 8 </span><span style="color:rgb(208,208,208)">    </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="font-kerning:none">(APPEND COMPILE_DEPS gtest tsan)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(215,0,95);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 9 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>endif</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(95,215,255);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">10 </span><span style="color:rgb(208,208,208)">  clang_compile</span><span style="color:rgb(255,135,0)">(</span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${source}</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(95,215,255);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">11 </span><span style="color:rgb(255,135,0)">          CFLAGS </span><span style="font-kerning:none">${TSAN_UNITTEST_CFLAGS}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${TARGET_CFLAGS}</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(255,135,0);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">12 </span><span style="font-kerning:none">          DEPS </span><span style="color:rgb(95,215,255)">${COMPILE_DEPS}</span><span style="font-kerning:none">)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(95,215,255);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">13 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="color:rgb(255,135,0)">(APPEND </span><span style="font-kerning:none">${obj_list}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)">)</span></div><div style="margin:0px;line-height:normal;font-family:Courier;color:rgb(215,0,95);background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">14 </span><span style="font-kerning:none"><b>endmacro</b></span><span style="color:rgb(255,135,0)">()</span></div></div><div><span style="color:rgb(255,135,0)"><br></span></div><div><span><div style="color:rgb(95,95,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 1 </span><span style="font-kerning:none"># Compile source for the given architecture, using compiler</span></div><div style="color:rgb(95,95,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 2 </span><span style="font-kerning:none"># options in ${ARGN}, and add it to the object list.</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 3 </span><span style="color:rgb(215,0,95)"><b>macro</b></span><span style="font-kerning:none">(asan_compile obj_list source arch kind)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 4 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>get_filename_component</b></span><span style="color:rgb(255,135,0)">(<wbr>basename </span><span style="color:rgb(95,215,255)">${source}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">NAME</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 5 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>if</b></span><span style="font-kerning:none">(CMAKE_CONFIGURATION_TYPES)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 6 </span><span style="color:rgb(208,208,208)">    </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(output_obj </span><span style="color:rgb(175,175,135)">"</span><span style="font-kerning:none">${CMAKE_CFG_INTDIR}</span><span style="color:rgb(175,175,135)">/</span><span style="font-kerning:none">${obj_<wbr>list}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${basename}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${arch}${<wbr>kind}</span><span style="color:rgb(175,175,135)">.o"</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 7 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>else</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 8 </span><span style="color:rgb(208,208,208)">    </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(output_obj </span><span style="color:rgb(175,175,135)">"</span><span style="font-kerning:none">${obj_list}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${basename}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${<wbr>arch}${kind}</span><span style="color:rgb(175,175,135)">.o"</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 9 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>endif</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(208,208,208);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">10 </span><span style="font-kerning:none">  get_target_flags_for_arch</span><span style="color:rgb(255,135,0)">(</span><span style="color:rgb(95,215,255)">${<wbr>arch}</span><span style="color:rgb(255,135,0)"> TARGET_CFLAGS)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">11 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(COMPILE_DEPS </span><span style="font-kerning:none">${ASAN_UNITTEST_HEADERS}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${ASAN_BLACKLIST_FILE}</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">12 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>if</b></span><span style="font-kerning:none">(</span><span style="color:rgb(215,0,95)">NOT</span><span style="font-kerning:none"> COMPILER_RT_STANDALONE_BUILD)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">13 </span><span style="color:rgb(208,208,208)">    </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="font-kerning:none">(APPEND COMPILE_DEPS gtest asan)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">14 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>endif</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">15 </span><span style="color:rgb(208,208,208)">  clang_compile</span><span style="color:rgb(255,135,0)">(</span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${source}</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">16 </span><span style="font-kerning:none">                CFLAGS </span><span style="color:rgb(95,215,255)">${ARGN}</span><span style="font-kerning:none"> </span><span style="color:rgb(95,215,255)">${TARGET_CFLAGS}</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">17 </span><span style="font-kerning:none">                DEPS </span><span style="color:rgb(95,215,255)">${COMPILE_DEPS}</span><span style="font-kerning:none">)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">18 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="color:rgb(255,135,0)">(APPEND </span><span style="font-kerning:none">${obj_list}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">19 </span><span style="font-kerning:none"><b>endmacro</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(255,135,0)"><span style="color:rgb(255,135,0)"><br></span></div><div><span><div style="color:rgb(95,95,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 1 </span><span style="font-kerning:none"># Compile source for the given architecture, using compiler</span></div><div style="color:rgb(95,95,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 2 </span><span style="font-kerning:none"># options in ${ARGN}, and add it to the object list.</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 3 </span><span style="color:rgb(215,0,95)"><b>macro</b></span><span style="font-kerning:none">(msan_compile obj_list source arch kind)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 4 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>get_filename_component</b></span><span style="color:rgb(255,135,0)">(<wbr>basename </span><span style="color:rgb(95,215,255)">${source}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">NAME</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 5 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(output_obj </span><span style="color:rgb(175,175,135)">"</span><span style="font-kerning:none">${basename}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${arch}${kind}</span><span style="color:rgb(175,175,135)">.o"</span><span style="color:rgb(255,135,0)"><wbr>)</span></div><div style="color:rgb(208,208,208);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 6 </span><span style="font-kerning:none">  get_target_flags_for_arch</span><span style="color:rgb(255,135,0)">(</span><span style="color:rgb(95,215,255)">${<wbr>arch}</span><span style="color:rgb(255,135,0)"> TARGET_CFLAGS)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 7 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(COMPILE_DEPS </span><span style="font-kerning:none">${MSAN_UNITTEST_HEADERS}</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 8 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>if</b></span><span style="font-kerning:none">(</span><span style="color:rgb(215,0,95)">NOT</span><span style="font-kerning:none"> COMPILER_RT_STANDALONE_BUILD)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 9 </span><span style="color:rgb(208,208,208)">    </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="font-kerning:none">(APPEND COMPILE_DEPS gtest msan)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">10 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>endif</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">11 </span><span style="color:rgb(208,208,208)">  clang_compile</span><span style="color:rgb(255,135,0)">(</span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${source}</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">12 </span><span style="font-kerning:none">                CFLAGS </span><span style="color:rgb(95,215,255)">${ARGN}</span><span style="font-kerning:none"> </span><span style="color:rgb(95,215,255)">${TARGET_CFLAGS}</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">13 </span><span style="font-kerning:none">                DEPS </span><span style="color:rgb(95,215,255)">${COMPILE_DEPS}</span><span style="font-kerning:none">)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">14 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="color:rgb(255,135,0)">(APPEND </span><span style="font-kerning:none">${obj_list}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">15 </span><span style="font-kerning:none"><b>endmacro</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(255,135,0)"><span style="color:rgb(255,135,0)"><br></span></div><div><span><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 1 </span><span style="color:rgb(215,0,95)"><b>macro</b></span><span style="font-kerning:none">(xray_compile obj_list source arch)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 2 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>get_filename_component</b></span><span style="color:rgb(255,135,0)">(<wbr>basename </span><span style="color:rgb(95,215,255)">${source}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">NAME</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 3 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>set</b></span><span style="color:rgb(255,135,0)">(output_obj </span><span style="color:rgb(175,175,135)">"</span><span style="font-kerning:none">${basename}</span><span style="color:rgb(175,175,135)">.</span><span style="font-kerning:none">${arch}</span><span style="color:rgb(175,175,135)">.o"</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(208,208,208);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 4 </span><span style="font-kerning:none">  get_target_flags_for_arch</span><span style="color:rgb(255,135,0)">(</span><span style="color:rgb(95,215,255)">${<wbr>arch}</span><span style="color:rgb(255,135,0)"> TARGET_CFLAGS)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 5 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>if</b></span><span style="font-kerning:none">(</span><span style="color:rgb(215,0,95)">NOT</span><span style="font-kerning:none"> COMPILER_RT_STANDALONE_BUILD)</span></div><div style="color:rgb(255,135,0);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 6 </span><span style="color:rgb(208,208,208)">    </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="font-kerning:none">(APPEND COMPILE_DEPS gtest_main xray)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 7 </span><span style="color:rgb(208,208,208)">  </span><span style="font-kerning:none"><b>endif</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 8 </span><span style="color:rgb(208,208,208)">  clang_compile</span><span style="color:rgb(255,135,0)">(</span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${source}</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)"> 9 </span><span style="color:rgb(255,135,0)">    CFLAGS </span><span style="font-kerning:none">${XRAY_UNITTEST_CFLAGS}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${TARGET_CFLAGS}</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">10 </span><span style="color:rgb(255,135,0)">    DEPS </span><span style="font-kerning:none">${COMPILE_DEPS}</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(95,215,255);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">11 </span><span style="color:rgb(208,208,208)">  </span><span style="color:rgb(215,0,95)"><b>list</b></span><span style="color:rgb(255,135,0)">(APPEND </span><span style="font-kerning:none">${obj_list}</span><span style="color:rgb(255,135,0)"> </span><span style="font-kerning:none">${output_obj}</span><span style="color:rgb(255,135,0)">)</span></div><div style="color:rgb(215,0,95);margin:0px;line-height:normal;font-family:Courier;background-color:rgb(18,18,18)"><span style="color:rgb(188,188,188);background-color:rgb(48,48,48)">12 </span><span style="font-kerning:none"><b>endmacro</b></span><span style="color:rgb(255,135,0)">()</span></div><div style="color:rgb(255,135,0)"><br></div><div>The code is duplicated, yet with minor differences, begging question e.g. why CMAKE_CFG_INTDIR path workaround is applied to asan, but not to others.</div><div><br></div><div>For future libraries in compiler-rt, should yet fifth copy of the function be added, or would it be better to extract it into a common macro which could be reused?</div><div>I can do the latter if agreed that it is a good idea.</div><span class="HOEnZb"><font color="#888888"><div><br></div><div>George</div></font></span></span></div></span></div></span></div></div></blockquote></div><br></div>