1 include(LLVMParseArguments) 2 3 # Compile a source into an object file with just-built Clang using 4 # a provided compile flags and dependenices. 5 # clang_compile(<object> <source> 6 # CFLAGS <list of compile flags> 7 # DEPS <list of dependencies>) 8 macro(clang_compile object_file source) 9 parse_arguments(SOURCE "CFLAGS;DEPS" "" ${ARGN}) 10 get_filename_component(source_rpath ${source} REALPATH) 11 add_custom_command( 12 OUTPUT ${object_file} 13 COMMAND clang ${SOURCE_CFLAGS} -c -o "${object_file}" ${source_rpath} 14 MAIN_DEPENDENCY ${source} 15 DEPENDS clang ${SOURCE_DEPS}) 16 endmacro() 17