aboutsummaryrefslogblamecommitdiff
path: root/cmake/Modules/CompilerRTCompile.cmake
blob: 2794cabe59c57113dcce9aafdc9d156ab083cc34 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16















                                                                         
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()