Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 1 | include(LLVMParseArguments) |
Oscar Fuentes | 751ea9d | 2008-11-14 22:06:14 +0000 | [diff] [blame] | 2 | include(LLVMProcessSources) |
Oscar Fuentes | d8a6dd6 | 2011-04-05 17:02:48 +0000 | [diff] [blame] | 3 | include(LLVM-Config) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 4 | |
NAKAMURA Takumi | e42fd0d | 2014-01-07 10:24:14 +0000 | [diff] [blame] | 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}") |
| 9 | endif() |
| 10 | if(LLVM_NO_RTTI) |
| 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") |
| 14 | elseif (MSVC) |
| 15 | llvm_replace_compiler_option(target_compile_flags "/GR" "/GR-") |
| 16 | endif () |
| 17 | endif() |
| 18 | |
| 19 | set_property(TARGET ${name} PROPERTY COMPILE_FLAGS "${target_compile_flags}") |
| 20 | set_property(TARGET ${name} APPEND PROPERTY COMPILE_DEFINITIONS ${LLVM_COMPILE_DEFINITIONS}) |
| 21 | endfunction() |
| 22 | |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 23 | function(add_llvm_symbol_exports target_name export_file) |
| 24 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
NAKAMURA Takumi | bbd2aaa | 2013-12-29 16:15:26 +0000 | [diff] [blame] | 25 | set(native_export_file "${target_name}.exports") |
NAKAMURA Takumi | 8121075 | 2013-12-29 16:15:18 +0000 | [diff] [blame] | 26 | add_custom_command(OUTPUT ${native_export_file} |
| 27 | COMMAND sed -e "s/^/_/" < ${export_file} > ${native_export_file} |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 28 | DEPENDS ${export_file} |
| 29 | VERBATIM |
| 30 | COMMENT "Creating export file for ${target_name}") |
| 31 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY |
NAKAMURA Takumi | 8121075 | 2013-12-29 16:15:18 +0000 | [diff] [blame] | 32 | LINK_FLAGS " -Wl,-exported_symbols_list,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}") |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 33 | elseif(LLVM_HAVE_LINK_VERSION_SCRIPT) |
| 34 | # Gold and BFD ld require a version script rather than a plain list. |
NAKAMURA Takumi | bbd2aaa | 2013-12-29 16:15:26 +0000 | [diff] [blame] | 35 | set(native_export_file "${target_name}.exports") |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 36 | # FIXME: Don't write the "local:" line on OpenBSD. |
NAKAMURA Takumi | 8121075 | 2013-12-29 16:15:18 +0000 | [diff] [blame] | 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} |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 43 | DEPENDS ${export_file} |
| 44 | VERBATIM |
| 45 | COMMENT "Creating export file for ${target_name}") |
| 46 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY |
Nico Weber | dc78dc9 | 2013-12-29 23:04:48 +0000 | [diff] [blame] | 47 | LINK_FLAGS " -Wl,--version-script,${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}") |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 48 | else() |
NAKAMURA Takumi | bbd2aaa | 2013-12-29 16:15:26 +0000 | [diff] [blame] | 49 | set(native_export_file "${target_name}.def") |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 50 | |
| 51 | set(CAT "type") |
| 52 | if(CYGWIN) |
| 53 | set(CAT "cat") |
| 54 | endif() |
| 55 | |
Nico Weber | 5c8a4a3 | 2013-12-29 04:05:23 +0000 | [diff] [blame] | 56 | # Using ${export_file} in add_custom_command directly confuses cmd.exe. |
| 57 | file(TO_NATIVE_PATH ${export_file} export_file_backslashes) |
| 58 | |
NAKAMURA Takumi | 8121075 | 2013-12-29 16:15:18 +0000 | [diff] [blame] | 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} |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 62 | DEPENDS ${export_file} |
| 63 | VERBATIM |
| 64 | COMMENT "Creating export file for ${target_name}") |
Nico Weber | 49d6f48 | 2013-12-29 07:43:09 +0000 | [diff] [blame] | 65 | if(CYGWIN OR MINGW) |
Nico Weber | 49da758 | 2013-12-29 06:56:28 +0000 | [diff] [blame] | 66 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY |
Nico Weber | dc78dc9 | 2013-12-29 23:04:48 +0000 | [diff] [blame] | 67 | LINK_FLAGS " ${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}") |
Nico Weber | 49da758 | 2013-12-29 06:56:28 +0000 | [diff] [blame] | 68 | else() |
| 69 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY |
Nico Weber | dc78dc9 | 2013-12-29 23:04:48 +0000 | [diff] [blame] | 70 | LINK_FLAGS " /DEF:${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}") |
NAKAMURA Takumi | 0a062bd | 2013-12-29 16:19:13 +0000 | [diff] [blame] | 71 | endif() |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 72 | endif() |
| 73 | |
| 74 | add_custom_target(${target_name}_exports DEPENDS ${native_export_file}) |
| 75 | |
| 76 | get_property(srcs TARGET ${target_name} PROPERTY SOURCES) |
| 77 | foreach(src ${srcs}) |
| 78 | get_filename_component(extension ${src} EXT) |
| 79 | if(extension STREQUAL ".cpp") |
| 80 | set(first_source_file ${src}) |
| 81 | break() |
| 82 | endif() |
| 83 | endforeach() |
| 84 | |
| 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. |
Quentin Colombet | cb2ae8d | 2014-01-16 06:43:55 +0000 | [diff] [blame^] | 88 | # FIXME: This is not safe because this will create the same target |
| 89 | # ${native_export_file} in several different file: |
| 90 | # - One where we emitted ${target_name}_exports |
| 91 | # - One where we emitted the build command for the following object. |
| 92 | # set_property(SOURCE ${first_source_file} APPEND PROPERTY |
| 93 | # OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${native_export_file}) |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 94 | |
| 95 | set_property(DIRECTORY APPEND |
| 96 | PROPERTY ADDITIONAL_MAKE_CLEAN_FILES ${native_export_file}) |
| 97 | |
| 98 | add_dependencies(${target_name} ${target_name}_exports) |
| 99 | endfunction(add_llvm_symbol_exports) |
| 100 | |
Nico Weber | 62588e1 | 2013-12-30 03:36:05 +0000 | [diff] [blame] | 101 | function(add_dead_strip target_name) |
Nico Weber | 34bac1f | 2014-01-05 00:37:45 +0000 | [diff] [blame] | 102 | # FIXME: With MSVS, consider compiling with /Gy and linking with /OPT:REF? |
| 103 | # But MinSizeRel seems to add that automatically, so maybe disable these |
| 104 | # flags instead if LLVM_NO_DEAD_STRIP is set. |
Yaron Keren | 03759bd | 2013-12-30 05:31:53 +0000 | [diff] [blame] | 105 | if(NOT CYGWIN AND NOT MINGW AND NOT MSVC) |
Nico Weber | 62588e1 | 2013-12-30 03:36:05 +0000 | [diff] [blame] | 106 | if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 107 | SET(CMAKE_CXX_FLAGS |
| 108 | "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections" |
| 109 | PARENT_SCOPE) |
| 110 | endif() |
| 111 | endif() |
| 112 | if(NOT LLVM_NO_DEAD_STRIP) |
| 113 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 114 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY |
| 115 | LINK_FLAGS " -Wl,-dead_strip") |
| 116 | elseif(NOT WIN32) |
| 117 | set_property(TARGET ${target_name} APPEND_STRING PROPERTY |
| 118 | LINK_FLAGS " -Wl,--gc-sections") |
| 119 | endif() |
| 120 | endif() |
| 121 | endfunction(add_dead_strip) |
| 122 | |
NAKAMURA Takumi | baa9f53 | 2013-12-30 06:48:30 +0000 | [diff] [blame] | 123 | # Set each output directory according to ${CMAKE_CONFIGURATION_TYPES}. |
| 124 | # Note: Don't set variables CMAKE_*_OUTPUT_DIRECTORY any more, |
| 125 | # or a certain builder, for eaxample, msbuild.exe, would be confused. |
| 126 | function(set_output_directory target bindir libdir) |
| 127 | if(NOT "${CMAKE_CFG_INTDIR}" STREQUAL ".") |
| 128 | foreach(build_mode ${CMAKE_CONFIGURATION_TYPES}) |
| 129 | string(TOUPPER "${build_mode}" CONFIG_SUFFIX) |
| 130 | string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} bi ${bindir}) |
| 131 | string(REPLACE ${CMAKE_CFG_INTDIR} ${build_mode} li ${libdir}) |
| 132 | set_target_properties(${target} PROPERTIES "RUNTIME_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${bi}) |
| 133 | set_target_properties(${target} PROPERTIES "ARCHIVE_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${li}) |
Douglas Gregor | bbebd81 | 2014-01-02 19:07:19 +0000 | [diff] [blame] | 134 | set_target_properties(${target} PROPERTIES "LIBRARY_OUTPUT_DIRECTORY_${CONFIG_SUFFIX}" ${li}) |
NAKAMURA Takumi | baa9f53 | 2013-12-30 06:48:30 +0000 | [diff] [blame] | 135 | endforeach() |
| 136 | else() |
| 137 | set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${bindir}) |
| 138 | set_target_properties(${target} PROPERTIES ARCHIVE_OUTPUT_DIRECTORY ${libdir}) |
| 139 | set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${libdir}) |
| 140 | endif() |
| 141 | endfunction() |
| 142 | |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 143 | macro(add_llvm_library name) |
Oscar Fuentes | 2c10b22 | 2008-11-15 02:08:08 +0000 | [diff] [blame] | 144 | llvm_process_sources( ALL_FILES ${ARGN} ) |
| 145 | add_library( ${name} ${ALL_FILES} ) |
NAKAMURA Takumi | baa9f53 | 2013-12-30 06:48:30 +0000 | [diff] [blame] | 146 | set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR}) |
Oscar Fuentes | 5ed9626 | 2011-02-18 22:06:14 +0000 | [diff] [blame] | 147 | set_property( GLOBAL APPEND PROPERTY LLVM_LIBS ${name} ) |
Nico Weber | 62588e1 | 2013-12-30 03:36:05 +0000 | [diff] [blame] | 148 | add_dead_strip( ${name} ) |
Oscar Fuentes | 8807bdd | 2008-09-22 18:21:51 +0000 | [diff] [blame] | 149 | if( LLVM_COMMON_DEPENDS ) |
| 150 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) |
| 151 | endif( LLVM_COMMON_DEPENDS ) |
Oscar Fuentes | ffe32e1 | 2010-10-14 15:54:41 +0000 | [diff] [blame] | 152 | |
| 153 | if( BUILD_SHARED_LIBS ) |
Oscar Fuentes | cc48b9a | 2011-03-12 16:48:54 +0000 | [diff] [blame] | 154 | llvm_config( ${name} ${LLVM_LINK_COMPONENTS} ) |
NAKAMURA Takumi | cb065a6 | 2013-08-14 03:34:49 +0000 | [diff] [blame] | 155 | if (MSVC) |
| 156 | set_target_properties(${name} |
| 157 | PROPERTIES |
| 158 | IMPORT_SUFFIX ".imp") |
| 159 | endif () |
Oscar Fuentes | ffe32e1 | 2010-10-14 15:54:41 +0000 | [diff] [blame] | 160 | |
Nico Weber | 06473f8 | 2013-12-29 05:39:01 +0000 | [diff] [blame] | 161 | if (LLVM_EXPORTED_SYMBOL_FILE) |
| 162 | add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) |
| 163 | endif() |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 164 | endif() |
| 165 | |
Oscar Fuentes | 978e528 | 2011-03-29 20:51:08 +0000 | [diff] [blame] | 166 | # Ensure that the system libraries always comes last on the |
| 167 | # list. Without this, linking the unit tests on MinGW fails. |
| 168 | link_system_libs( ${name} ) |
| 169 | |
Nick Lewycky | 61aed87 | 2011-04-29 02:12:06 +0000 | [diff] [blame] | 170 | if( EXCLUDE_FROM_ALL ) |
| 171 | set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON) |
| 172 | else() |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 173 | if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY OR ${name} STREQUAL "LTO") |
| 174 | install(TARGETS ${name} |
| 175 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} |
| 176 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) |
| 177 | endif() |
Nick Lewycky | 61aed87 | 2011-04-29 02:12:06 +0000 | [diff] [blame] | 178 | endif() |
Oscar Fuentes | 3145e92 | 2011-02-20 22:06:10 +0000 | [diff] [blame] | 179 | set_target_properties(${name} PROPERTIES FOLDER "Libraries") |
Daniel Dunbar | faaa76d | 2011-11-29 01:31:52 +0000 | [diff] [blame] | 180 | |
| 181 | # Add the explicit dependency information for this library. |
| 182 | # |
| 183 | # It would be nice to verify that we have the dependencies for this library |
| 184 | # name, but using get_property(... SET) doesn't suffice to determine if a |
| 185 | # property has been set to an empty value. |
| 186 | get_property(lib_deps GLOBAL PROPERTY LLVMBUILD_LIB_DEPS_${name}) |
| 187 | target_link_libraries(${name} ${lib_deps}) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 188 | endmacro(add_llvm_library name) |
| 189 | |
Oscar Fuentes | bbc1067 | 2009-11-10 02:45:37 +0000 | [diff] [blame] | 190 | macro(add_llvm_loadable_module name) |
Oscar Fuentes | ff11a23 | 2010-10-22 19:03:24 +0000 | [diff] [blame] | 191 | if( NOT LLVM_ON_UNIX OR CYGWIN ) |
Oscar Fuentes | bbc1067 | 2009-11-10 02:45:37 +0000 | [diff] [blame] | 192 | message(STATUS "Loadable modules not supported on this platform. |
| 193 | ${name} ignored.") |
NAKAMURA Takumi | a8c1c3f | 2010-12-10 02:15:36 +0000 | [diff] [blame] | 194 | # Add empty "phony" target |
| 195 | add_custom_target(${name}) |
Oscar Fuentes | bbc1067 | 2009-11-10 02:45:37 +0000 | [diff] [blame] | 196 | else() |
Oscar Fuentes | bbc1067 | 2009-11-10 02:45:37 +0000 | [diff] [blame] | 197 | llvm_process_sources( ALL_FILES ${ARGN} ) |
Oscar Fuentes | 9f2b384 | 2010-12-22 08:30:17 +0000 | [diff] [blame] | 198 | if (MODULE) |
| 199 | set(libkind MODULE) |
| 200 | else() |
| 201 | set(libkind SHARED) |
| 202 | endif() |
| 203 | |
NAKAMURA Takumi | 14d09b8 | 2013-12-29 16:15:31 +0000 | [diff] [blame] | 204 | add_library( ${name} ${libkind} ${ALL_FILES} ) |
Jordan Rose | 353bdcd | 2014-01-02 19:47:45 +0000 | [diff] [blame] | 205 | set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR}) |
NAKAMURA Takumi | 14d09b8 | 2013-12-29 16:15:31 +0000 | [diff] [blame] | 206 | set_target_properties( ${name} PROPERTIES PREFIX "" ) |
Nico Weber | 62588e1 | 2013-12-30 03:36:05 +0000 | [diff] [blame] | 207 | add_dead_strip( ${name} ) |
NAKAMURA Takumi | 14d09b8 | 2013-12-29 16:15:31 +0000 | [diff] [blame] | 208 | |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 209 | if (LLVM_EXPORTED_SYMBOL_FILE) |
| 210 | add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) |
| 211 | endif(LLVM_EXPORTED_SYMBOL_FILE) |
| 212 | |
Oscar Fuentes | cc48b9a | 2011-03-12 16:48:54 +0000 | [diff] [blame] | 213 | llvm_config( ${name} ${LLVM_LINK_COMPONENTS} ) |
Oscar Fuentes | 978e528 | 2011-03-29 20:51:08 +0000 | [diff] [blame] | 214 | link_system_libs( ${name} ) |
Oscar Fuentes | cc48b9a | 2011-03-12 16:48:54 +0000 | [diff] [blame] | 215 | |
Douglas Gregor | 66df54f | 2009-11-10 15:30:33 +0000 | [diff] [blame] | 216 | if (APPLE) |
| 217 | # Darwin-specific linker flags for loadable modules. |
Nico Weber | dc78dc9 | 2013-12-29 23:04:48 +0000 | [diff] [blame] | 218 | set_property(TARGET ${name} APPEND_STRING PROPERTY |
| 219 | LINK_FLAGS " -Wl,-flat_namespace -Wl,-undefined -Wl,suppress") |
Douglas Gregor | 66df54f | 2009-11-10 15:30:33 +0000 | [diff] [blame] | 220 | endif() |
| 221 | |
Alp Toker | c0b7bb5 | 2014-01-08 11:10:24 +0000 | [diff] [blame] | 222 | if (MODULE) |
| 223 | set_property(TARGET ${name} PROPERTY SUFFIX ${LLVM_PLUGIN_EXT}) |
| 224 | endif () |
| 225 | |
Oscar Fuentes | 638aaec | 2011-04-26 14:55:27 +0000 | [diff] [blame] | 226 | if( EXCLUDE_FROM_ALL ) |
Nick Lewycky | 61aed87 | 2011-04-29 02:12:06 +0000 | [diff] [blame] | 227 | set_target_properties( ${name} PROPERTIES EXCLUDE_FROM_ALL ON) |
Oscar Fuentes | 638aaec | 2011-04-26 14:55:27 +0000 | [diff] [blame] | 228 | else() |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 229 | if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
| 230 | install(TARGETS ${name} |
| 231 | LIBRARY DESTINATION lib${LLVM_LIBDIR_SUFFIX} |
| 232 | ARCHIVE DESTINATION lib${LLVM_LIBDIR_SUFFIX}) |
| 233 | endif() |
Oscar Fuentes | 638aaec | 2011-04-26 14:55:27 +0000 | [diff] [blame] | 234 | endif() |
Oscar Fuentes | bbc1067 | 2009-11-10 02:45:37 +0000 | [diff] [blame] | 235 | endif() |
Oscar Fuentes | 3145e92 | 2011-02-20 22:06:10 +0000 | [diff] [blame] | 236 | |
| 237 | set_target_properties(${name} PROPERTIES FOLDER "Loadable modules") |
Oscar Fuentes | bbc1067 | 2009-11-10 02:45:37 +0000 | [diff] [blame] | 238 | endmacro(add_llvm_loadable_module name) |
| 239 | |
| 240 | |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 241 | macro(add_llvm_executable name) |
Oscar Fuentes | 2c10b22 | 2008-11-15 02:08:08 +0000 | [diff] [blame] | 242 | llvm_process_sources( ALL_FILES ${ARGN} ) |
Oscar Fuentes | 0c2443a | 2009-11-23 00:21:43 +0000 | [diff] [blame] | 243 | if( EXCLUDE_FROM_ALL ) |
| 244 | add_executable(${name} EXCLUDE_FROM_ALL ${ALL_FILES}) |
| 245 | else() |
| 246 | add_executable(${name} ${ALL_FILES}) |
| 247 | endif() |
Nico Weber | 62588e1 | 2013-12-30 03:36:05 +0000 | [diff] [blame] | 248 | add_dead_strip( ${name} ) |
Nico Weber | c27118d | 2013-12-28 23:31:44 +0000 | [diff] [blame] | 249 | |
| 250 | if (LLVM_EXPORTED_SYMBOL_FILE) |
| 251 | add_llvm_symbol_exports( ${name} ${LLVM_EXPORTED_SYMBOL_FILE} ) |
| 252 | endif(LLVM_EXPORTED_SYMBOL_FILE) |
| 253 | |
Oscar Fuentes | 0c2443a | 2009-11-23 00:21:43 +0000 | [diff] [blame] | 254 | set(EXCLUDE_FROM_ALL OFF) |
NAKAMURA Takumi | baa9f53 | 2013-12-30 06:48:30 +0000 | [diff] [blame] | 255 | set_output_directory(${name} ${LLVM_RUNTIME_OUTPUT_INTDIR} ${LLVM_LIBRARY_OUTPUT_INTDIR}) |
Oscar Fuentes | 978e528 | 2011-03-29 20:51:08 +0000 | [diff] [blame] | 256 | llvm_config( ${name} ${LLVM_LINK_COMPONENTS} ) |
Oscar Fuentes | 3fca0e8 | 2009-08-14 04:38:57 +0000 | [diff] [blame] | 257 | if( LLVM_COMMON_DEPENDS ) |
| 258 | add_dependencies( ${name} ${LLVM_COMMON_DEPENDS} ) |
| 259 | endif( LLVM_COMMON_DEPENDS ) |
Oscar Fuentes | 978e528 | 2011-03-29 20:51:08 +0000 | [diff] [blame] | 260 | link_system_libs( ${name} ) |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 261 | endmacro(add_llvm_executable name) |
| 262 | |
| 263 | |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 264 | set (LLVM_TOOLCHAIN_TOOLS |
| 265 | llvm-ar |
| 266 | llvm-objdump |
| 267 | ) |
| 268 | |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 269 | macro(add_llvm_tool name) |
| 270 | set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR}) |
Oscar Fuentes | dea579f | 2009-11-23 00:32:42 +0000 | [diff] [blame] | 271 | if( NOT LLVM_BUILD_TOOLS ) |
Oscar Fuentes | 0c2443a | 2009-11-23 00:21:43 +0000 | [diff] [blame] | 272 | set(EXCLUDE_FROM_ALL ON) |
| 273 | endif() |
Oscar Fuentes | 46d8a93 | 2010-09-25 20:25:25 +0000 | [diff] [blame] | 274 | add_llvm_executable(${name} ${ARGN}) |
Hans Wennborg | 1654627 | 2013-08-24 00:20:36 +0000 | [diff] [blame] | 275 | |
| 276 | list(FIND LLVM_TOOLCHAIN_TOOLS ${name} LLVM_IS_${name}_TOOLCHAIN_TOOL) |
| 277 | if (LLVM_IS_${name}_TOOLCHAIN_TOOL GREATER -1 OR NOT LLVM_INSTALL_TOOLCHAIN_ONLY) |
| 278 | if( LLVM_BUILD_TOOLS ) |
| 279 | install(TARGETS ${name} RUNTIME DESTINATION bin) |
| 280 | endif() |
Oscar Fuentes | dea579f | 2009-11-23 00:32:42 +0000 | [diff] [blame] | 281 | endif() |
Oscar Fuentes | 3145e92 | 2011-02-20 22:06:10 +0000 | [diff] [blame] | 282 | set_target_properties(${name} PROPERTIES FOLDER "Tools") |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 283 | endmacro(add_llvm_tool name) |
| 284 | |
| 285 | |
| 286 | macro(add_llvm_example name) |
| 287 | # set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_EXAMPLES_BINARY_DIR}) |
Oscar Fuentes | dea579f | 2009-11-23 00:32:42 +0000 | [diff] [blame] | 288 | if( NOT LLVM_BUILD_EXAMPLES ) |
Oscar Fuentes | 0c2443a | 2009-11-23 00:21:43 +0000 | [diff] [blame] | 289 | set(EXCLUDE_FROM_ALL ON) |
| 290 | endif() |
Oscar Fuentes | 46d8a93 | 2010-09-25 20:25:25 +0000 | [diff] [blame] | 291 | add_llvm_executable(${name} ${ARGN}) |
Oscar Fuentes | dea579f | 2009-11-23 00:32:42 +0000 | [diff] [blame] | 292 | if( LLVM_BUILD_EXAMPLES ) |
| 293 | install(TARGETS ${name} RUNTIME DESTINATION examples) |
| 294 | endif() |
Oscar Fuentes | 3145e92 | 2011-02-20 22:06:10 +0000 | [diff] [blame] | 295 | set_target_properties(${name} PROPERTIES FOLDER "Examples") |
Oscar Fuentes | a229b3c | 2008-09-22 01:08:49 +0000 | [diff] [blame] | 296 | endmacro(add_llvm_example name) |
Oscar Fuentes | cdc9549 | 2008-09-26 04:40:32 +0000 | [diff] [blame] | 297 | |
| 298 | |
Oscar Fuentes | 3145e92 | 2011-02-20 22:06:10 +0000 | [diff] [blame] | 299 | macro(add_llvm_utility name) |
| 300 | add_llvm_executable(${name} ${ARGN}) |
| 301 | set_target_properties(${name} PROPERTIES FOLDER "Utils") |
| 302 | endmacro(add_llvm_utility name) |
| 303 | |
| 304 | |
Oscar Fuentes | cdc9549 | 2008-09-26 04:40:32 +0000 | [diff] [blame] | 305 | macro(add_llvm_target target_name) |
Oscar Fuentes | 4f0f335 | 2011-07-25 20:17:01 +0000 | [diff] [blame] | 306 | include_directories(BEFORE |
| 307 | ${CMAKE_CURRENT_BINARY_DIR} |
| 308 | ${CMAKE_CURRENT_SOURCE_DIR}) |
Douglas Gregor | 85fedbe | 2009-06-23 17:57:35 +0000 | [diff] [blame] | 309 | add_llvm_library(LLVM${target_name} ${ARGN} ${TABLEGEN_OUTPUT}) |
Oscar Fuentes | ba1186c | 2011-02-20 02:55:27 +0000 | [diff] [blame] | 310 | set( CURRENT_LLVM_TARGET LLVM${target_name} ) |
Oscar Fuentes | cdc9549 | 2008-09-26 04:40:32 +0000 | [diff] [blame] | 311 | endmacro(add_llvm_target) |
Michael J. Spencer | e734f54 | 2012-04-26 19:43:35 +0000 | [diff] [blame] | 312 | |
| 313 | # Add external project that may want to be built as part of llvm such as Clang, |
| 314 | # lld, and Polly. This adds two options. One for the source directory of the |
| 315 | # project, which defaults to ${CMAKE_CURRENT_SOURCE_DIR}/${name}. Another to |
Alp Toker | 171b0c3 | 2013-12-20 00:33:39 +0000 | [diff] [blame] | 316 | # enable or disable building it with everything else. |
NAKAMURA Takumi | 700cd40 | 2012-10-05 14:10:17 +0000 | [diff] [blame] | 317 | # Additional parameter can be specified as the name of directory. |
Michael J. Spencer | e734f54 | 2012-04-26 19:43:35 +0000 | [diff] [blame] | 318 | macro(add_llvm_external_project name) |
NAKAMURA Takumi | 700cd40 | 2012-10-05 14:10:17 +0000 | [diff] [blame] | 319 | set(add_llvm_external_dir "${ARGN}") |
| 320 | if("${add_llvm_external_dir}" STREQUAL "") |
| 321 | set(add_llvm_external_dir ${name}) |
| 322 | endif() |
Argyrios Kyrtzidis | 7eec9d0 | 2013-08-21 19:13:44 +0000 | [diff] [blame] | 323 | list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}") |
NAKAMURA Takumi | 700cd40 | 2012-10-05 14:10:17 +0000 | [diff] [blame] | 324 | string(REPLACE "-" "_" nameUNDERSCORE ${name}) |
| 325 | string(TOUPPER ${nameUNDERSCORE} nameUPPER) |
| 326 | set(LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/${add_llvm_external_dir}" |
Michael J. Spencer | e734f54 | 2012-04-26 19:43:35 +0000 | [diff] [blame] | 327 | CACHE PATH "Path to ${name} source directory") |
| 328 | if (NOT ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} STREQUAL "" |
| 329 | AND EXISTS ${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR}/CMakeLists.txt) |
| 330 | option(LLVM_EXTERNAL_${nameUPPER}_BUILD |
| 331 | "Whether to build ${name} as part of LLVM" ON) |
| 332 | if (LLVM_EXTERNAL_${nameUPPER}_BUILD) |
NAKAMURA Takumi | 700cd40 | 2012-10-05 14:10:17 +0000 | [diff] [blame] | 333 | add_subdirectory(${LLVM_EXTERNAL_${nameUPPER}_SOURCE_DIR} ${add_llvm_external_dir}) |
Michael J. Spencer | e734f54 | 2012-04-26 19:43:35 +0000 | [diff] [blame] | 334 | endif() |
| 335 | endif() |
| 336 | endmacro(add_llvm_external_project) |
Chandler Carruth | a5d42f8 | 2012-06-21 05:16:58 +0000 | [diff] [blame] | 337 | |
Argyrios Kyrtzidis | 7eec9d0 | 2013-08-21 19:13:44 +0000 | [diff] [blame] | 338 | macro(add_llvm_tool_subdirectory name) |
| 339 | list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${name}") |
| 340 | add_subdirectory(${name}) |
| 341 | endmacro(add_llvm_tool_subdirectory) |
| 342 | |
| 343 | macro(ignore_llvm_tool_subdirectory name) |
| 344 | list(APPEND LLVM_IMPLICIT_PROJECT_IGNORE "${CMAKE_CURRENT_SOURCE_DIR}/${name}") |
| 345 | endmacro(ignore_llvm_tool_subdirectory) |
| 346 | |
| 347 | function(add_llvm_implicit_external_projects) |
| 348 | set(list_of_implicit_subdirs "") |
| 349 | file(GLOB sub-dirs "${CMAKE_CURRENT_SOURCE_DIR}/*") |
| 350 | foreach(dir ${sub-dirs}) |
| 351 | if(IS_DIRECTORY "${dir}") |
| 352 | list(FIND LLVM_IMPLICIT_PROJECT_IGNORE "${dir}" tool_subdir_ignore) |
| 353 | if( tool_subdir_ignore EQUAL -1 |
| 354 | AND EXISTS "${dir}/CMakeLists.txt") |
| 355 | get_filename_component(fn "${dir}" NAME) |
| 356 | list(APPEND list_of_implicit_subdirs "${fn}") |
| 357 | endif() |
| 358 | endif() |
| 359 | endforeach() |
| 360 | |
| 361 | foreach(external_proj ${list_of_implicit_subdirs}) |
| 362 | add_llvm_external_project("${external_proj}") |
| 363 | endforeach() |
| 364 | endfunction(add_llvm_implicit_external_projects) |
| 365 | |
Chandler Carruth | a5d42f8 | 2012-06-21 05:16:58 +0000 | [diff] [blame] | 366 | # Generic support for adding a unittest. |
Chandler Carruth | 94d0251 | 2012-06-21 09:51:26 +0000 | [diff] [blame] | 367 | function(add_unittest test_suite test_name) |
Chandler Carruth | a5d42f8 | 2012-06-21 05:16:58 +0000 | [diff] [blame] | 368 | if( NOT LLVM_BUILD_TESTS ) |
| 369 | set(EXCLUDE_FROM_ALL ON) |
| 370 | endif() |
| 371 | |
NAKAMURA Takumi | e42fd0d | 2014-01-07 10:24:14 +0000 | [diff] [blame] | 372 | # Visual Studio 2012 only supports up to 8 template parameters in |
| 373 | # std::tr1::tuple by default, but gtest requires 10 |
| 374 | if (MSVC AND MSVC_VERSION EQUAL 1700) |
| 375 | list(APPEND LLVM_COMPILE_DEFINITIONS _VARIADIC_MAX=10) |
| 376 | endif () |
| 377 | |
| 378 | include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include) |
| 379 | if (NOT LLVM_ENABLE_THREADS) |
| 380 | list(APPEND LLVM_COMPILE_DEFINITIONS GTEST_HAS_PTHREAD=0) |
| 381 | endif () |
| 382 | |
| 383 | if (SUPPORTS_NO_VARIADIC_MACROS_FLAG) |
| 384 | set(LLVM_COMPILE_FLAGS "-Wno-variadic-macros") |
| 385 | endif () |
| 386 | |
| 387 | set(LLVM_NO_RTTI ON) |
| 388 | |
Chandler Carruth | a5d42f8 | 2012-06-21 05:16:58 +0000 | [diff] [blame] | 389 | add_llvm_executable(${test_name} ${ARGN}) |
NAKAMURA Takumi | baa9f53 | 2013-12-30 06:48:30 +0000 | [diff] [blame] | 390 | set(outdir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) |
| 391 | set_output_directory(${test_name} ${outdir} ${outdir}) |
Chandler Carruth | a5d42f8 | 2012-06-21 05:16:58 +0000 | [diff] [blame] | 392 | target_link_libraries(${test_name} |
| 393 | gtest |
| 394 | gtest_main |
| 395 | LLVMSupport # gtest needs it for raw_ostream. |
| 396 | ) |
| 397 | |
| 398 | add_dependencies(${test_suite} ${test_name}) |
| 399 | get_target_property(test_suite_folder ${test_suite} FOLDER) |
| 400 | if (NOT ${test_suite_folder} STREQUAL "NOTFOUND") |
| 401 | set_property(TARGET ${test_name} PROPERTY FOLDER "${test_suite_folder}") |
| 402 | endif () |
NAKAMURA Takumi | e42fd0d | 2014-01-07 10:24:14 +0000 | [diff] [blame] | 403 | llvm_update_compile_flags(${test_name}) |
Chandler Carruth | a5d42f8 | 2012-06-21 05:16:58 +0000 | [diff] [blame] | 404 | endfunction() |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 405 | |
| 406 | # This function provides an automatic way to 'configure'-like generate a file |
Alp Toker | 171b0c3 | 2013-12-20 00:33:39 +0000 | [diff] [blame] | 407 | # based on a set of common and custom variables, specifically targeting the |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 408 | # variables needed for the 'lit.site.cfg' files. This function bundles the |
| 409 | # common variables that any Lit instance is likely to need, and custom |
| 410 | # variables can be passed in. |
| 411 | function(configure_lit_site_cfg input output) |
| 412 | foreach(c ${LLVM_TARGETS_TO_BUILD}) |
| 413 | set(TARGETS_BUILT "${TARGETS_BUILT} ${c}") |
| 414 | endforeach(c) |
| 415 | set(TARGETS_TO_BUILD ${TARGETS_BUILT}) |
| 416 | |
| 417 | set(SHLIBEXT "${LTDL_SHLIB_EXT}") |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 418 | |
| 419 | if(BUILD_SHARED_LIBS) |
| 420 | set(LLVM_SHARED_LIBS_ENABLED "1") |
| 421 | else() |
| 422 | set(LLVM_SHARED_LIBS_ENABLED "0") |
| 423 | endif(BUILD_SHARED_LIBS) |
| 424 | |
| 425 | if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin") |
| 426 | set(SHLIBPATH_VAR "DYLD_LIBRARY_PATH") |
| 427 | else() # Default for all other unix like systems. |
| 428 | # CMake hardcodes the library locaction using rpath. |
| 429 | # Therefore LD_LIBRARY_PATH is not required to run binaries in the |
| 430 | # build dir. We pass it anyways. |
| 431 | set(SHLIBPATH_VAR "LD_LIBRARY_PATH") |
| 432 | endif() |
| 433 | |
| 434 | # Configuration-time: See Unit/lit.site.cfg.in |
NAKAMURA Takumi | 0dc10d5 | 2013-12-04 11:15:17 +0000 | [diff] [blame] | 435 | if (CMAKE_CFG_INTDIR STREQUAL ".") |
| 436 | set(LLVM_BUILD_MODE ".") |
| 437 | else () |
| 438 | set(LLVM_BUILD_MODE "%(build_mode)s") |
| 439 | endif () |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 440 | |
| 441 | set(LLVM_SOURCE_DIR ${LLVM_MAIN_SRC_DIR}) |
| 442 | set(LLVM_BINARY_DIR ${LLVM_BINARY_DIR}) |
NAKAMURA Takumi | e73df85 | 2013-12-16 16:03:08 +0000 | [diff] [blame] | 443 | string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR}) |
| 444 | string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} LLVM_LIBS_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) |
Jordan Rose | 353bdcd | 2014-01-02 19:47:45 +0000 | [diff] [blame] | 445 | string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} SHLIBDIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 446 | set(PYTHON_EXECUTABLE ${PYTHON_EXECUTABLE}) |
| 447 | set(ENABLE_SHARED ${LLVM_SHARED_LIBS_ENABLED}) |
| 448 | set(SHLIBPATH_VAR ${SHLIBPATH_VAR}) |
| 449 | |
| 450 | if(LLVM_ENABLE_ASSERTIONS AND NOT MSVC_IDE) |
| 451 | set(ENABLE_ASSERTIONS "1") |
| 452 | else() |
| 453 | set(ENABLE_ASSERTIONS "0") |
| 454 | endif() |
| 455 | |
Tim Northover | bfe8468 | 2013-02-14 16:49:32 +0000 | [diff] [blame] | 456 | set(HOST_OS ${CMAKE_SYSTEM_NAME}) |
| 457 | set(HOST_ARCH ${CMAKE_SYSTEM_PROCESSOR}) |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 458 | |
Roman Divacky | c987111 | 2013-08-27 19:25:01 +0000 | [diff] [blame] | 459 | if (CLANG_ENABLE_ARCMT) |
| 460 | set(ENABLE_CLANG_ARCMT "1") |
| 461 | else() |
| 462 | set(ENABLE_CLANG_ARCMT "0") |
| 463 | endif() |
| 464 | if (CLANG_ENABLE_REWRITER) |
| 465 | set(ENABLE_CLANG_REWRITER "1") |
| 466 | else() |
| 467 | set(ENABLE_CLANG_REWRITER "0") |
| 468 | endif() |
| 469 | if (CLANG_ENABLE_STATIC_ANALYZER) |
| 470 | set(ENABLE_CLANG_STATIC_ANALYZER "1") |
| 471 | else() |
| 472 | set(ENABLE_CLANG_STATIC_ANALYZER "0") |
| 473 | endif() |
| 474 | |
Chandler Carruth | 3511dd3 | 2012-06-28 06:36:24 +0000 | [diff] [blame] | 475 | configure_file(${input} ${output} @ONLY) |
| 476 | endfunction() |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 477 | |
| 478 | # A raw function to create a lit target. This is used to implement the testuite |
| 479 | # management functions. |
| 480 | function(add_lit_target target comment) |
NAKAMURA Takumi | 69a89c7 | 2013-12-19 17:11:08 +0000 | [diff] [blame] | 481 | parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN}) |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 482 | set(LIT_ARGS "${ARG_ARGS} ${LLVM_LIT_ARGS}") |
| 483 | separate_arguments(LIT_ARGS) |
NAKAMURA Takumi | 0dc10d5 | 2013-12-04 11:15:17 +0000 | [diff] [blame] | 484 | if (NOT CMAKE_CFG_INTDIR STREQUAL ".") |
| 485 | list(APPEND LIT_ARGS --param build_mode=${CMAKE_CFG_INTDIR}) |
| 486 | endif () |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 487 | set(LIT_COMMAND |
| 488 | ${PYTHON_EXECUTABLE} |
NAKAMURA Takumi | 69a89c7 | 2013-12-19 17:11:08 +0000 | [diff] [blame] | 489 | ${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 490 | ${LIT_ARGS} |
| 491 | ) |
| 492 | foreach(param ${ARG_PARAMS}) |
| 493 | list(APPEND LIT_COMMAND --param ${param}) |
| 494 | endforeach() |
NAKAMURA Takumi | 04a664e | 2012-12-24 22:43:59 +0000 | [diff] [blame] | 495 | if( ARG_DEPENDS ) |
| 496 | add_custom_target(${target} |
| 497 | COMMAND ${LIT_COMMAND} ${ARG_DEFAULT_ARGS} |
| 498 | COMMENT "${comment}" |
| 499 | ) |
| 500 | add_dependencies(${target} ${ARG_DEPENDS}) |
| 501 | else() |
| 502 | add_custom_target(${target} |
Nico Weber | b42359d | 2013-12-29 00:11:20 +0000 | [diff] [blame] | 503 | COMMAND ${CMAKE_COMMAND} -E echo "${target} does nothing, no tools built.") |
NAKAMURA Takumi | 04a664e | 2012-12-24 22:43:59 +0000 | [diff] [blame] | 504 | message(STATUS "${target} does nothing.") |
| 505 | endif() |
NAKAMURA Takumi | 03fc730 | 2013-12-02 11:31:19 +0000 | [diff] [blame] | 506 | |
| 507 | # Tests should be excluded from "Build Solution". |
| 508 | set_target_properties(${target} PROPERTIES EXCLUDE_FROM_DEFAULT_BUILD ON) |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 509 | endfunction() |
| 510 | |
| 511 | # A function to add a set of lit test suites to be driven through 'check-*' targets. |
| 512 | function(add_lit_testsuite target comment) |
| 513 | parse_arguments(ARG "PARAMS;DEPENDS;ARGS" "" ${ARGN}) |
| 514 | |
NAKAMURA Takumi | 54d2274 | 2012-10-10 13:32:55 +0000 | [diff] [blame] | 515 | # EXCLUDE_FROM_ALL excludes the test ${target} out of check-all. |
| 516 | if(NOT EXCLUDE_FROM_ALL) |
| 517 | # Register the testsuites, params and depends for the global check rule. |
| 518 | set_property(GLOBAL APPEND PROPERTY LLVM_LIT_TESTSUITES ${ARG_DEFAULT_ARGS}) |
| 519 | set_property(GLOBAL APPEND PROPERTY LLVM_LIT_PARAMS ${ARG_PARAMS}) |
| 520 | set_property(GLOBAL APPEND PROPERTY LLVM_LIT_DEPENDS ${ARG_DEPENDS}) |
| 521 | set_property(GLOBAL APPEND PROPERTY LLVM_LIT_EXTRA_ARGS ${ARG_ARGS}) |
| 522 | endif() |
Chandler Carruth | 69ce665 | 2012-06-30 10:14:14 +0000 | [diff] [blame] | 523 | |
| 524 | # Produce a specific suffixed check rule. |
| 525 | add_lit_target(${target} ${comment} |
| 526 | ${ARG_DEFAULT_ARGS} |
| 527 | PARAMS ${ARG_PARAMS} |
| 528 | DEPENDS ${ARG_DEPENDS} |
| 529 | ARGS ${ARG_ARGS} |
| 530 | ) |
| 531 | endfunction() |