1 include(LLVMParseArguments)
2 include(LLVMProcessSources)
5 function(llvm_update_compile_flags name)
6 get_property(target_compile_flags TARGET ${name} PROPERTY COMPILE_FLAGS)
7 if(NOT "${LLVM_COMPILE_FLAGS}" STREQUAL "")
8 set(target_compile_flags "${target_compile_flags} ${LLVM_COMPILE_FLAGS}")
11 list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_RTTI=0)
12 if (LLVM_COMPILER_IS_GCC_COMPATIBLE)
13 set(target_compile_flags "${target_compile_flags} -fno-rtti")
15 llvm_replace_compiler_option(target_compile_flags "/GR" "/GR-")
19 set_property(TARGET ${name} PROPERTY COMPILE_FLAGS "${target_compile_flags}")
20 set_property(TARGET ${name} APPEND PROPERTY COMPILE_DEFINITIONS ${LLVM_COMPILE_DEFINITIONS})
23 function(add_llvm_symbol_exports target_name export_file)
24 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
25 set(native_export_file "${target_name}.exports")
26 add_custom_command(OUTPUT ${native_export_file}
27 COMMAND sed -e "s/^/_/" < ${export_file} > ${native_export_file}
28 DEPENDS ${export_file}
30 COMMENT "Creating export file for ${target_name}")
31 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
32 LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
33 elseif(LLVM_HAVE_LINK_VERSION_SCRIPT)
34 # Gold and BFD ld require a version script rather than a plain list.
35 set(native_export_file "${target_name}.exports")
36 # FIXME: Don't write the "local:" line on OpenBSD.
37 add_custom_command(OUTPUT ${native_export_file}
38 COMMAND echo "{" > ${native_export_file}
39 COMMAND grep -q "[[:alnum:]]" ${export_file} && echo " global:" >> ${native_export_file} || :
40 COMMAND sed -e "s/$/;/" -e "s/^/ /" < ${export_file} >> ${native_export_file}
41 COMMAND echo " local: *;" >> ${native_export_file}
42 COMMAND echo "};" >> ${native_export_file}
43 DEPENDS ${export_file}
45 COMMENT "Creating export file for ${target_name}")
46 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
47 LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
49 set(native_export_file "${target_name}.def")
56 # Using ${export_file} in add_custom_command directly confuses cmd.exe.
57 file(TO_NATIVE_PATH ${export_file} export_file_backslashes)
59 add_custom_command(OUTPUT ${native_export_file}
60 COMMAND ${CMAKE_COMMAND} -E echo "EXPORTS" > ${native_export_file}
61 COMMAND ${CAT} ${export_file_backslashes} >> ${native_export_file}
62 DEPENDS ${export_file}
64 COMMENT "Creating export file for ${target_name}")
66 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
67 LINK_FLAGS " ${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
69 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
70 LINK_FLAGS " /DEF:${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}")
74 add_custom_target(${target_name}_exports DEPENDS ${native_export_file})
76 get_property(srcs TARGET ${target_name} PROPERTY SOURCES)
78 get_filename_component(extension ${src} EXT)
79 if(extension STREQUAL ".cpp")
80 set(first_source_file ${src})
85 # Force re-linking when the exports file changes. Actually, it
86 # forces recompilation of the source file. The LINK_DEPENDS target
87 # property only works for makefile-based generators.
88 set_property(SOURCE ${first_source_file} APPEND PROPERTY
89 OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${native_export_file})
91 set_property(DIRECTORY APPEND
92 PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${native_export_file})
94 add_dependencies(${target_name} ${target_name}_exports)
95 endfunction(add_llvm_symbol_exports)
97 function(add_dead_strip target_name)
98 # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF?
99 # But MinSizeRel seems to add that automatically, so maybe disable these
100 # flags instead if LLVM_NO_DEAD_STRIP is set.
101 if(NOT CYGWIN AND NOT MINGW AND NOT MSVC)
102 if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
104 "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections"
108 if(NOT LLVM_NO_DEAD_STRIP)
109 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
110 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
111 LINK_FLAGS " -Wl,-dead_strip")
113 set_property(TARGET ${target_name} APPEND_STRING PROPERTY
114 LINK_FLAGS " -Wl,--gc-sections")
117 endfunction(add_dead_strip)
119 # Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}.
120 # Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more,
121 # or a certain builder, for eaxample, msbuild.exe, would be confused.
122 function(set_output_directory target bindir libdir)
123 if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".")
124 foreach(build_mode ${CMAKE_CONFIGURATION_TYPES})
125 string(TOUPPER "${build_mode}" CONFIG_SUFFIX)
126 string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} bi ${bindir})
127 string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} li ${libdir})
128 set_target_properties(${target} PROPERTIES "RUNTIME_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${bi})
129 set_target_properties(${target} PROPERTIES "ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${li})
130 set_target_properties(${target} PROPERTIES "LIBRARY_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${li})
133 set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${bindir})
134 set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libdir})
135 set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libdir})
139 macro(add_llvm_library name)
140 llvm_process_sources( ALL_FILES ${ARGN} )
141 add_library( ${name} ${ALL_FILES} )
142 set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
143 set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} )
144 add_dead_strip( ${name} )
145 if( LLVM_COMMON_DEPENDS )
146 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
147 endif( LLVM_COMMON_DEPENDS )
149 if( BUILD_SHARED_LIBS )
150 llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
152 set_target_properties(${name}
154 IMPORT_SUFFIX ".imp")
157 if (LLVM_EXPORTED_SYMBOL_FILE)
158 add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
162 # Ensure that the system libraries always comes last on the
163 # list. Without this, linking the unit tests on MinGW fails.
164 link_system_libs( ${name} )
166 if( EXCLUDE_FROM_ALL )
167 set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
169 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO")
170 install(TARGETS ${name}
171 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
172 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
175 set_target_properties(${name} PROPERTIES FOLDER "Libraries")
177 # Add the explicit dependency information for this library.
179 # It would be nice to verify that we have the dependencies for this library
180 # name, but using get_property(... SET) doesn't suffice to determine if a
181 # property has been set to an empty value.
182 get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name})
183 target_link_libraries(${name} ${lib_deps})
184 endmacro(add_llvm_library name)
186 macro(add_llvm_loadable_module name)
187 if( NOT LLVM_ON_UNIX OR CYGWIN )
188 message(STATUS "Loadable modules not supported on this platform.
190 # Add empty "phony" target
191 add_custom_target(${name})
193 llvm_process_sources( ALL_FILES ${ARGN} )
200 add_library( ${name} ${libkind} ${ALL_FILES} )
201 set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
202 set_target_properties( ${name} PROPERTIES PREFIX "" )
203 add_dead_strip( ${name} )
205 if (LLVM_EXPORTED_SYMBOL_FILE)
206 add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
207 endif(LLVM_EXPORTED_SYMBOL_FILE)
209 llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
210 link_system_libs( ${name} )
213 # Darwin-specific linker flags for loadable modules.
214 set_property(TARGET ${name} APPEND_STRING PROPERTY
215 LINK_FLAGS " -Wl,-flat_namespace -Wl,-undefined -Wl,suppress")
219 set_property(TARGET ${name} PROPERTY SUFFIX ${LLVM_PLUGIN_EXT})
222 if( EXCLUDE_FROM_ALL )
223 set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON)
225 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
226 install(TARGETS ${name}
227 LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX}
228 ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX})
233 set_target_properties(${name} PROPERTIES FOLDER "Loadable modules")
234 endmacro(add_llvm_loadable_module name)
237 macro(add_llvm_executable name)
238 llvm_process_sources( ALL_FILES ${ARGN} )
239 if( EXCLUDE_FROM_ALL )
240 add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES})
242 add_executable(${name} ${ALL_FILES})
244 add_dead_strip( ${name} )
246 if (LLVM_EXPORTED_SYMBOL_FILE)
247 add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} )
248 endif(LLVM_EXPORTED_SYMBOL_FILE)
250 set(EXCLUDE_FROM_ALL OFF)
251 set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR})
252 llvm_config( ${name} ${LLVM_LINK_COMPONENTS} )
253 if( LLVM_COMMON_DEPENDS )
254 add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} )
255 endif( LLVM_COMMON_DEPENDS )
256 link_system_libs( ${name} )
257 endmacro(add_llvm_executable name)
260 set (LLVM_TOOLCHAIN_TOOLS
265 macro(add_llvm_tool name)
266 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR})
267 if( NOT LLVM_BUILD_TOOLS )
268 set(EXCLUDE_FROM_ALL ON)
270 add_llvm_executable(${name} ${ARGN})
272 list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL)
273 if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
274 if( LLVM_BUILD_TOOLS )
275 install(TARGETS ${name} RUNTIME DESTINATION bin)
278 set_target_properties(${name} PROPERTIES FOLDER "Tools")
279 endmacro(add_llvm_tool name)
282 macro(add_llvm_example name)
283 # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR})
284 if( NOT LLVM_BUILD_EXAMPLES )
285 set(EXCLUDE_FROM_ALL ON)
287 add_llvm_executable(${name} ${ARGN})
288 if( LLVM_BUILD_EXAMPLES )
289 install(TARGETS ${name} RUNTIME DESTINATION examples)
291 set_target_properties(${name} PROPERTIES FOLDER "Examples")
292 endmacro(add_llvm_example name)
295 macro(add_llvm_utility name)
296 add_llvm_executable(${name} ${ARGN})
297 set_target_properties(${name} PROPERTIES FOLDER "Utils")
298 endmacro(add_llvm_utility name)
301 macro(add_llvm_target target_name)
302 include_directories(BEFORE
303 ${CMAKE_CURRENT_BINARY_DIR}
304 ${CMAKE_CURRENT_SOURCE_DIR})
305 add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT})
306 set( CURRENT_LLVM_TARGET LLVM${target_name} )
307 endmacro(add_llvm_target)
309 # Add external project that may want to be built as part of llvm such as Clang,
310 # lld, and Polly. This adds two options. One for the source directory of the
311 # project, which defaults to ${CMAKE_CURRENT_SOURCE_DIR}/${name}. Another to
312 # enable or disable building it with everything else.
313 # Additional parameter can be specified as the name of directory.
314 macro(add_llvm_external_project name)
315 set(add_llvm_external_dir "${ARGN}")
316 if("${add_llvm_external_dir}" STREQUAL "")
317 set(add_llvm_external_dir ${name})
319 list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}")
320 string(REPLACE "-" "_" nameUNDERSCORE ${name})
321 string(TOUPPER ${nameUNDERSCORE} nameUPPER)
322 set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}"
323 CACHE PATH "Path to ${name} source directory")
324 if (NOT ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} STREQUAL ""
325 AND EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt)
326 option(LLVM_EXTERNAL_${nameUPPER}_BUILD
327 "Whether to build ${name} as part of LLVM" ON)
328 if (LLVM_EXTERNAL_${nameUPPER}_BUILD)
329 add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir})
332 endmacro(add_llvm_external_project)
334 macro(add_llvm_tool_subdirectory name)
335 list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${name}")
336 add_subdirectory(${name})
337 endmacro(add_llvm_tool_subdirectory)
339 macro(ignore_llvm_tool_subdirectory name)
340 list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${name}")
341 endmacro(ignore_llvm_tool_subdirectory)
343 function(add_llvm_implicit_external_projects)
344 set(list_of_implicit_subdirs "")
345 file(GLOB sub-dirs "${CMAKE_CURRENT_SOURCE_DIR}/*")
346 foreach(dir ${sub-dirs})
347 if(IS_DIRECTORY "${dir}")
348 list(FIND LLVM_IMPLICIT_PROJECT_IGNORE "${dir}" tool_subdir_ignore)
349 if( tool_subdir_ignore EQUAL -1
350 AND EXISTS "${dir}/CMakeLists.txt")
351 get_filename_component(fn "${dir}" NAME)
352 list(APPEND list_of_implicit_subdirs "${fn}")
357 foreach(external_proj ${list_of_implicit_subdirs})
358 add_llvm_external_project("${external_proj}")
360 endfunction(add_llvm_implicit_external_projects)
362 # Generic support for adding a unittest.
363 function(add_unittest test_suite test_name)
364 if( NOT LLVM_BUILD_TESTS )
365 set(EXCLUDE_FROM_ALL ON)
368 # Visual Studio 2012 only supports up to 8 template parameters in
369 # std::tr1::tuple by default, but gtest requires 10
370 if (MSVC AND MSVC_VERSION EQUAL 1700)
371 list(APPEND LLVM_COMPILE_DEFINITIONS _VARIADIC_MAX=10)
374 include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include)
375 if (NOT LLVM_ENABLE_THREADS)
376 list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_PTHREAD=0)
379 if (SUPPORTS_NO_VARIADIC_MACROS_FLAG)
380 set(LLVM_COMPILE_FLAGS "-Wno-variadic-macros")
385 add_llvm_executable(${test_name} ${ARGN})
386 set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
387 set_output_directory(${test_name} ${outdir} ${outdir})
388 target_link_libraries(${test_name}
391 LLVMSupport # gtest needs it for raw_ostream.
394 add_dependencies(${test_suite} ${test_name})
395 get_target_property(test_suite_folder ${test_suite} FOLDER)
396 if (NOT ${test_suite_folder} STREQUAL "NOTFOUND")
397 set_property(TARGET ${test_name} PROPERTY FOLDER "${test_suite_folder}")
399 llvm_update_compile_flags(${test_name})
402 # This function provides an automatic way to 'configure'-like generate a file
403 # based on a set of common and custom variables, specifically targeting the
404 # variables needed for the 'lit.site.cfg' files. This function bundles the
405 # common variables that any Lit instance is likely to need, and custom
406 # variables can be passed in.
407 function(configure_lit_site_cfg input output)
408 foreach(c ${LLVM_TARGETS_TO_BUILD})
409 set(TARGETS_BUILT "${TARGETS_BUILT} ${c}")
411 set(TARGETS_TO_BUILD ${TARGETS_BUILT})
413 set(SHLIBEXT "${LTDL_SHLIB_EXT}")
415 if(BUILD_SHARED_LIBS)
416 set(LLVM_SHARED_LIBS_ENABLED "1")
418 set(LLVM_SHARED_LIBS_ENABLED "0")
419 endif(BUILD_SHARED_LIBS)
421 if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
422 set(SHLIBPATH_VAR "DYLD_LIBRARY_PATH")
423 else() # Default for all other unix like systems.
424 # CMake hardcodes the library locaction using rpath.
425 # Therefore LD_LIBRARY_PATH is not required to run binaries in the
426 # build dir. We pass it anyways.
427 set(SHLIBPATH_VAR "LD_LIBRARY_PATH")
430 # Configuration-time: See Unit/lit.site.cfg.in
431 if (CMAKE_CFG_INTDIR STREQUAL ".")
432 set(LLVM_BUILD_MODE ".")
434 set(LLVM_BUILD_MODE "%(build_mode)s")
437 set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR})
438 set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR})
439 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
440 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
441 string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} SHLIBDIR ${LLVM_LIBRARY_OUTPUT_INTDIR})
442 set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE})
443 set(ENABLE_SHARED ${LLVM_SHARED_LIBS_ENABLED})
444 set(SHLIBPATH_VAR ${SHLIBPATH_VAR})
446 if(LLVM_ENABLE_ASSERTIONS AND NOT MSVC_IDE)
447 set(ENABLE_ASSERTIONS "1")
449 set(ENABLE_ASSERTIONS "0")
452 set(HOST_OS ${CMAKE_SYSTEM_NAME})
453 set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR})
455 if (CLANG_ENABLE_ARCMT)
456 set(ENABLE_CLANG_ARCMT "1")
458 set(ENABLE_CLANG_ARCMT "0")
460 if (CLANG_ENABLE_REWRITER)
461 set(ENABLE_CLANG_REWRITER "1")
463 set(ENABLE_CLANG_REWRITER "0")
465 if (CLANG_ENABLE_STATIC_ANALYZER)
466 set(ENABLE_CLANG_STATIC_ANALYZER "1")
468 set(ENABLE_CLANG_STATIC_ANALYZER "0")
471 configure_file(${input} ${output} @ONLY)
474 # A raw function to create a lit target. This is used to implement the testuite
475 # management functions.
476 function(add_lit_target target comment)
477 parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
478 set(LIT_ARGS "${ARG_ARGS} ${LLVM_LIT_ARGS}")
479 separate_arguments(LIT_ARGS)
480 if (NOT CMAKE_CFG_INTDIR STREQUAL ".")
481 list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR})
485 ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py
488 foreach(param ${ARG_PARAMS})
489 list(APPEND LIT_COMMAND --param ${param})
492 add_custom_target(${target}
493 COMMAND ${LIT_COMMAND} ${ARG_DEFAULT_ARGS}
496 add_dependencies(${target} ${ARG_DEPENDS})
498 add_custom_target(${target}
499 COMMAND ${CMAKE_COMMAND} -E echo "${target} does nothing, no tools built.")
500 message(STATUS "${target} does nothing.")
503 # Tests should be excluded from "Build Solution".
504 set_target_properties(${target} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON)
507 # A function to add a set of lit test suites to be driven through 'check-*' targets.
508 function(add_lit_testsuite target comment)
509 parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN})
511 # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all.
512 if(NOT EXCLUDE_FROM_ALL)
513 # Register the testsuites, params and depends for the global check rule.
514 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_DEFAULT_ARGS})
515 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS})
516 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS})
517 set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${ARG_ARGS})
520 # Produce a specific suffixed check rule.
521 add_lit_target(${target} ${comment}
524 DEPENDS ${ARG_DEPENDS}