llvm-project/compiler-rt/cmake/Modules/CompilerRTCompile.cmake
Reid Kleckner 0140ce483f Append -D__func__=__FUNCTION__ to SANITIZER_COMMON_CFLAGS
This way it gets picked up for all sanitizer libs, both sanitizer_common
and asan.  I believe those are the only libs that build with asan.
There should be no need to set the __func__ definition inside
clang_compile.

llvm-svn: 202303
2014-02-26 21:54:39 +00:00

21 lines
735 B
CMake

include(LLVMParseArguments)
# Compile a source into an object file with COMPILER_RT_TEST_COMPILER using
# a provided compile flags and dependenices.
# clang_compile(<object> <source>
# CFLAGS <list of compile flags>
# DEPS <list of dependencies>)
macro(clang_compile object_file source)
parse_arguments(SOURCE "CFLAGS;DEPS" "" ${ARGN})
get_filename_component(source_rpath ${source} REALPATH)
if(NOT COMPILER_RT_STANDALONE_BUILD)
list(APPEND SOURCE_DEPS clang)
endif()
add_custom_command(
OUTPUT ${object_file}
COMMAND ${COMPILER_RT_TEST_COMPILER} ${SOURCE_CFLAGS} -c -o "${object_file}"
${source_rpath}
MAIN_DEPENDENCY ${source}
DEPENDS ${SOURCE_DEPS})
endmacro()