build tree. Now just-built Clang is used to:
1) compile instrumented sources (as before);
2) compile non-instrumented sources;
3) compile our own instrumented version of googletest;
4) link it all together using -fsanitize=address flag
(instead of trying to copy linker behavior in
CMake build rules).
This makes ASan unittests pretty much self-consistent
and independent of other LLVM libraries.
llvm-svn: 170541
17 lines
613 B
CMake
17 lines
613 B
CMake
include(LLVMParseArguments)
|
|
|
|
# Compile a source into an object file with just-built Clang 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)
|
|
add_custom_command(
|
|
OUTPUT ${object_file}
|
|
COMMAND clang ${SOURCE_CFLAGS} -c -o "${object_file}" ${source_rpath}
|
|
MAIN_DEPENDENCY ${source}
|
|
DEPENDS clang ${SOURCE_DEPS})
|
|
endmacro()
|