5a8eb980271d520f864cbac27d651c3e79057e77
[oota-llvm.git] / CMakeLists.txt
1 # See docs/CMake.html for instructions about how to build LLVM with CMake.
2
3 project(LLVM)
4 cmake_minimum_required(VERSION 2.8)
5
6 # Add path for custom modules
7 set(CMAKE_MODULE_PATH
8   ${CMAKE_MODULE_PATH}
9   "${CMAKE_CURRENT_SOURCE_DIR}/cmake"
10   "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules"
11   )
12
13 set(LLVM_VERSION_MAJOR 3)
14 set(LLVM_VERSION_MINOR 4)
15
16 set(PACKAGE_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}svn")
17
18 option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
19
20 option(LLVM_STATIC_MSVC_RUNTIME "When using MSVC, link against the static run-time (/MT)" OFF)
21
22 option(LLVM_USE_FOLDERS "Enable solution folders in Visual Studio. Disable for Express versions." ON)
23 if ( LLVM_USE_FOLDERS )
24   set_property(GLOBAL PROPERTY USE_FOLDERS ON)
25 endif()
26
27 include(VersionFromVCS)
28
29 option(LLVM_APPEND_VC_REV
30   "Append the version control system revision id to LLVM version" OFF)
31
32 if( LLVM_APPEND_VC_REV )
33   add_version_info_from_vcs(PACKAGE_VERSION)
34 endif()
35
36 set(PACKAGE_NAME LLVM)
37 set(PACKAGE_STRING "${PACKAGE_NAME} ${PACKAGE_VERSION}")
38 set(PACKAGE_BUGREPORT "http://llvm.org/bugs/")
39
40 # Configure CPack.
41 set(CPACK_PACKAGE_VENDOR "LLVM")
42 set(CPACK_PACKAGE_VERSION_MAJOR ${LLVM_VERSION_MAJOR})
43 set(CPACK_PACKAGE_VERSION_MINOR ${LLVM_VERSION_MINOR})
44 if( LLVM_APPEND_VC_REV )
45   add_version_info_from_vcs(CPACK_PACKAGE_VERSION_PATCH)
46 else()
47   set(CPACK_PACKAGE_VERSION_PATCH "svn")
48 endif()
49 set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE.TXT")
50 if(WIN32 AND NOT UNIX)
51   set(CPACK_PACKAGE_ICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_logo.bmp")
52   set(CPACK_NSIS_MODIFY_PATH "ON")
53   set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
54   set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
55     "ExecWait '$INSTDIR/tools/msbuild/install.bat'")
56   set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
57     "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'")
58 endif()
59 include(CPack)
60
61 # Sanity check our source directory to make sure that we are not trying to
62 # generate an in-tree build (unless on MSVC_IDE, where it is ok), and to make
63 # sure that we don't have any stray generated files lying around in the tree
64 # (which would end up getting picked up by header search, instead of the correct
65 # versions).
66 if( CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR AND NOT MSVC_IDE )
67   message(FATAL_ERROR "In-source builds are not allowed.
68 CMake would overwrite the makefiles distributed with LLVM.
69 Please create a directory and run cmake from there, passing the path
70 to this source directory as the last argument.
71 This process created the file `CMakeCache.txt' and the directory `CMakeFiles'.
72 Please delete them.")
73 endif()
74 if( NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR )
75   file(GLOB_RECURSE
76     tablegenned_files_on_include_dir
77     "${CMAKE_CURRENT_SOURCE_DIR}/include/llvm/*.gen")
78   file(GLOB_RECURSE
79     tablegenned_files_on_lib_dir
80     "${CMAKE_CURRENT_SOURCE_DIR}/lib/Target/*.inc")
81   if( tablegenned_files_on_include_dir OR tablegenned_files_on_lib_dir)
82     message(FATAL_ERROR "Apparently there is a previous in-source build,
83 probably as the result of running `configure' and `make' on
84 ${CMAKE_CURRENT_SOURCE_DIR}.
85 This may cause problems. The suspicious files are:
86 ${tablegenned_files_on_lib_dir}
87 ${tablegenned_files_on_include_dir}
88 Please clean the source directory.")
89   endif()
90 endif()
91
92 string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
93
94 set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR})
95 set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include)
96 set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
97 set(LLVM_TOOLS_BINARY_DIR ${LLVM_BINARY_DIR}/bin)
98 set(LLVM_EXAMPLES_BINARY_DIR ${LLVM_BINARY_DIR}/examples)
99 set(LLVM_LIBDIR_SUFFIX "" CACHE STRING "Define suffix of library directory name (32/64)" )
100
101 set(LLVM_ALL_TARGETS
102   AArch64
103   ARM
104   CppBackend
105   Hexagon
106   Mips
107   MSP430
108   NVPTX
109   PowerPC
110   R600
111   Sparc
112   SystemZ
113   X86
114   XCore
115   )
116
117 # List of targets with JIT support:
118 set(LLVM_TARGETS_WITH_JIT X86 PowerPC AArch64 ARM Mips SystemZ)
119
120 set(LLVM_TARGETS_TO_BUILD "all"
121     CACHE STRING "Semicolon-separated list of targets to build, or \"all\".")
122
123 set(LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ""
124   CACHE STRING "Semicolon-separated list of experimental targets to build.")
125
126 option(BUILD_SHARED_LIBS
127   "Build all libraries as shared libraries instead of static" OFF)
128
129 option(LLVM_ENABLE_CBE_PRINTF_A "Set to ON if CBE is enabled for printf %a output" ON)
130 if(LLVM_ENABLE_CBE_PRINTF_A)
131   set(ENABLE_CBE_PRINTF_A 1)
132 endif()
133
134 option(LLVM_ENABLE_TIMESTAMPS "Enable embedding timestamp information in build" ON)
135 if(LLVM_ENABLE_TIMESTAMPS)
136   set(ENABLE_TIMESTAMPS 1)
137 endif()
138
139 option(LLVM_ENABLE_BACKTRACES "Enable embedding backtraces on crash." ON)
140 if(LLVM_ENABLE_BACKTRACES)
141   set(ENABLE_BACKTRACES 1)
142 endif()
143
144 option(LLVM_ENABLE_CRASH_OVERRIDES "Enable crash overrides." ON)
145 if(LLVM_ENABLE_CRASH_OVERRIDES)
146   set(ENABLE_CRASH_OVERRIDES 1)
147 endif()
148
149 option(LLVM_ENABLE_FFI "Use libffi to call external functions from the interpreter" OFF)
150 set(FFI_LIBRARY_DIR "" CACHE PATH "Additional directory, where CMake should search for libffi.so")
151 set(FFI_INCLUDE_DIR "" CACHE PATH "Additional directory, where CMake should search for ffi.h or ffi/ffi.h")
152
153 set(LLVM_TARGET_ARCH "host"
154   CACHE STRING "Set target to use for LLVM JIT or use \"host\" for automatic detection.")
155
156 option(LLVM_ENABLE_TERMINFO "Use terminfo database if available." ON)
157
158 option(LLVM_ENABLE_THREADS "Use threads if available." ON)
159
160 option(LLVM_ENABLE_ZLIB "Use zlib for compression/decompression if available." ON)
161
162 if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
163   set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
164 endif()
165
166 set(LLVM_TARGETS_TO_BUILD
167    ${LLVM_TARGETS_TO_BUILD}
168    ${LLVM_EXPERIMENTAL_TARGETS_TO_BUILD})
169 list(REMOVE_DUPLICATES LLVM_TARGETS_TO_BUILD)
170
171 set(llvm_builded_incs_dir ${LLVM_BINARY_DIR}/include/llvm)
172
173 include(AddLLVMDefinitions)
174
175 option(LLVM_ENABLE_PIC "Build Position-Independent Code" ON)
176
177 # MSVC has a gazillion warnings with this.
178 if( MSVC )
179   option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." OFF)
180 else( MSVC )
181   option(LLVM_ENABLE_WARNINGS "Enable compiler warnings." ON)
182 endif()
183
184 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
185 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
186
187 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
188   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
189 else()
190   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
191 endif()
192
193 option(LLVM_USE_INTEL_JITEVENTS
194   "Use Intel JIT API to inform Intel(R) VTune(TM) Amplifier XE 2011 about JIT code"
195   OFF)
196
197 if( LLVM_USE_INTEL_JITEVENTS )
198   # Verify we are on a supported platform
199   if( NOT CMAKE_SYSTEM_NAME MATCHES "Windows" AND NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
200     message(FATAL_ERROR
201       "Intel JIT API support is available on Linux and Windows only.")
202   endif()
203 endif( LLVM_USE_INTEL_JITEVENTS )
204
205 option(LLVM_USE_OPROFILE
206   "Use opagent JIT interface to inform OProfile about JIT code" OFF)
207
208 # If enabled, verify we are on a platform that supports oprofile.
209 if( LLVM_USE_OPROFILE )
210   if( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
211     message(FATAL_ERROR "OProfile support is available on Linux only.") 
212   endif( NOT CMAKE_SYSTEM_NAME MATCHES "Linux" )
213 endif( LLVM_USE_OPROFILE )
214
215 set(LLVM_USE_SANITIZER "" CACHE STRING
216   "Define the sanitizer used to build binaries and tests.")
217
218 option(LLVM_USE_SPLIT_DWARF
219   "Use -gsplit-dwarf when compiling llvm." OFF)
220
221 # Define an option controlling whether we should build for 32-bit on 64-bit
222 # platforms, where supported.
223 if( CMAKE_SIZEOF_VOID_P EQUAL 8 AND NOT WIN32 )
224   # TODO: support other platforms and toolchains.
225   option(LLVM_BUILD_32_BITS "Build 32 bits executables and libraries." OFF)
226 endif()
227
228 # Define the default arguments to use with 'lit', and an option for the user to
229 # override.
230 set(LIT_ARGS_DEFAULT "-sv")
231 if (MSVC OR XCODE)
232   set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
233 endif()
234 set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
235
236 # On Win32 hosts, provide an option to specify the path to the GnuWin32 tools.
237 if( WIN32 AND NOT CYGWIN )
238   set(LLVM_LIT_TOOLS_DIR "" CACHE PATH "Path to GnuWin32 tools")
239 endif()
240
241 # Define options to control the inclusion and default build behavior for
242 # components which may not strictly be necessary (tools, examples, and tests).
243 #
244 # This is primarily to support building smaller or faster project files.
245 option(LLVM_INCLUDE_TOOLS "Generate build targets for the LLVM tools." ON)
246 option(LLVM_BUILD_TOOLS
247   "Build the LLVM tools. If OFF, just generate build targets." ON)
248
249 option(LLVM_BUILD_RUNTIME
250   "Build the LLVM runtime libraries." ON)
251 option(LLVM_BUILD_EXAMPLES
252   "Build the LLVM example programs. If OFF, just generate build targets." OFF)
253 option(LLVM_INCLUDE_EXAMPLES "Generate build targets for the LLVM examples" ON)
254
255 option(LLVM_BUILD_TESTS
256   "Build LLVM unit tests. If OFF, just generate build targets." OFF)
257 option(LLVM_INCLUDE_TESTS "Generate build targets for the LLVM unit tests." ON)
258
259 option (LLVM_BUILD_DOCS "Build the llvm documentation." OFF)
260 option (LLVM_INCLUDE_DOCS "Generate build targets for llvm documentation." ON)
261 option (LLVM_ENABLE_DOXYGEN "Use doxygen to generate llvm documentation." OFF)
262
263 # All options referred to from HandleLLVMOptions have to be specified
264 # BEFORE this include, otherwise options will not be correctly set on
265 # first cmake run
266 include(config-ix)
267
268 # By default, we target the host, but this can be overridden at CMake
269 # invocation time.
270 set(LLVM_DEFAULT_TARGET_TRIPLE "${LLVM_HOST_TRIPLE}" CACHE STRING
271   "Default target for which LLVM will generate code." )
272 set(TARGET_TRIPLE "${LLVM_DEFAULT_TARGET_TRIPLE}")
273
274 include(HandleLLVMOptions)
275
276 # Verify that we can find a Python 2 interpreter.  Python 3 is unsupported.
277 set(Python_ADDITIONAL_VERSIONS 2.7 2.6 2.5)
278 include(FindPythonInterp)
279 if( NOT PYTHONINTERP_FOUND )
280   message(FATAL_ERROR
281 "Unable to find Python interpreter, required for builds and testing.
282
283 Please install Python or specify the PYTHON_EXECUTABLE CMake variable.")
284 endif()
285
286 ######
287 # LLVMBuild Integration
288 #
289 # We use llvm-build to generate all the data required by the CMake based
290 # build system in one swoop:
291 #
292 #  - We generate a file (a CMake fragment) in the object root which contains
293 #    all the definitions that are required by CMake.
294 #
295 #  - We generate the library table used by llvm-config.
296 #
297 #  - We generate the dependencies for the CMake fragment, so that we will
298 #    automatically reconfigure outselves.
299
300 set(LLVMBUILDTOOL "${LLVM_MAIN_SRC_DIR}/utils/llvm-build/llvm-build")
301 set(LLVMCONFIGLIBRARYDEPENDENCIESINC
302   "${LLVM_BINARY_DIR}/tools/llvm-config/LibraryDependencies.inc")
303 set(LLVMBUILDCMAKEFRAG
304   "${LLVM_BINARY_DIR}/LLVMBuild.cmake")
305
306 # Create the list of optional components that are enabled
307 if (LLVM_USE_INTEL_JITEVENTS)
308   set(LLVMOPTIONALCOMPONENTS IntelJITEvents)
309 endif (LLVM_USE_INTEL_JITEVENTS)
310 if (LLVM_USE_OPROFILE)
311   set(LLVMOPTIONALCOMPONENTS ${LLVMOPTIONALCOMPONENTS} OProfileJIT)
312 endif (LLVM_USE_OPROFILE)
313
314 message(STATUS "Constructing LLVMBuild project information")
315 execute_process(
316   COMMAND ${PYTHON_EXECUTABLE} ${LLVMBUILDTOOL}
317             --native-target "${LLVM_NATIVE_ARCH}"
318             --enable-targets "${LLVM_TARGETS_TO_BUILD}"
319             --enable-optional-components "${LLVMOPTIONALCOMPONENTS}"
320             --write-library-table ${LLVMCONFIGLIBRARYDEPENDENCIESINC}
321             --write-cmake-fragment ${LLVMBUILDCMAKEFRAG}
322             OUTPUT_VARIABLE LLVMBUILDOUTPUT
323             ERROR_VARIABLE LLVMBUILDERRORS
324             OUTPUT_STRIP_TRAILING_WHITESPACE
325             ERROR_STRIP_TRAILING_WHITESPACE
326   RESULT_VARIABLE LLVMBUILDRESULT)
327
328 # On Win32, CMake doesn't properly handle piping the default output/error
329 # streams into the GUI console. So, we explicitly catch and report them.
330 if( NOT "${LLVMBUILDOUTPUT}" STREQUAL "")
331   message(STATUS "llvm-build output: ${LLVMBUILDOUTPUT}")
332 endif()
333 if( NOT "${LLVMBUILDRESULT}" STREQUAL "0" )
334   message(FATAL_ERROR
335     "Unexpected failure executing llvm-build: ${LLVMBUILDERRORS}")
336 endif()
337
338 # Include the generated CMake fragment. This will define properties from the
339 # LLVMBuild files in a format which is easy to consume from CMake, and will add
340 # the dependencies so that CMake will reconfigure properly when the LLVMBuild
341 # files change.
342 include(${LLVMBUILDCMAKEFRAG})
343
344 ######
345
346 # Configure all of the various header file fragments LLVM uses which depend on
347 # configuration variables.
348 set(LLVM_ENUM_TARGETS "")
349 set(LLVM_ENUM_ASM_PRINTERS "")
350 set(LLVM_ENUM_ASM_PARSERS "")
351 set(LLVM_ENUM_DISASSEMBLERS "")
352 foreach(t ${LLVM_TARGETS_TO_BUILD})
353   set( td ${LLVM_MAIN_SRC_DIR}/lib/Target/${t} )
354
355   list(FIND LLVM_ALL_TARGETS ${t} idx)
356   list(FIND LLVM_EXPERIMENTAL_TARGETS_TO_BUILD ${t} idy)
357   if( idx LESS 0 AND idy LESS 0 )
358     message(FATAL_ERROR "The target `${t}' does not exist.
359     It should be one of\n${LLVM_ALL_TARGETS}")
360   else()
361     set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${t})\n")
362   endif()
363
364   file(GLOB asmp_file "${td}/*AsmPrinter.cpp")
365   if( asmp_file )
366     set(LLVM_ENUM_ASM_PRINTERS
367       "${LLVM_ENUM_ASM_PRINTERS}LLVM_ASM_PRINTER(${t})\n")
368   endif()
369   if( EXISTS ${td}/AsmParser/CMakeLists.txt )
370     set(LLVM_ENUM_ASM_PARSERS
371       "${LLVM_ENUM_ASM_PARSERS}LLVM_ASM_PARSER(${t})\n")
372   endif()
373   if( EXISTS ${td}/Disassembler/CMakeLists.txt )
374     set(LLVM_ENUM_DISASSEMBLERS
375       "${LLVM_ENUM_DISASSEMBLERS}LLVM_DISASSEMBLER(${t})\n")
376   endif()
377 endforeach(t)
378
379 # Produce the target definition files, which provide a way for clients to easily
380 # include various classes of targets.
381 configure_file(
382   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmPrinters.def.in
383   ${LLVM_BINARY_DIR}/include/llvm/Config/AsmPrinters.def
384   )
385 configure_file(
386   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/AsmParsers.def.in
387   ${LLVM_BINARY_DIR}/include/llvm/Config/AsmParsers.def
388   )
389 configure_file(
390   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Disassemblers.def.in
391   ${LLVM_BINARY_DIR}/include/llvm/Config/Disassemblers.def
392   )
393 configure_file(
394   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in
395   ${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def
396   )
397
398 # Configure the three LLVM configuration header files.
399 configure_file(
400   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/config.h.cmake
401   ${LLVM_BINARY_DIR}/include/llvm/Config/config.h)
402 configure_file(
403   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/llvm-config.h.cmake
404   ${LLVM_BINARY_DIR}/include/llvm/Config/llvm-config.h)
405 configure_file(
406   ${LLVM_MAIN_INCLUDE_DIR}/llvm/Support/DataTypes.h.cmake
407   ${LLVM_BINARY_DIR}/include/llvm/Support/DataTypes.h)
408
409 set( CMAKE_RUNTIME_OUTPUT_DIRECTORY ${LLVM_TOOLS_BINARY_DIR} )
410 set( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
411 set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${LLVM_BINARY_DIR}/lib )
412
413 set(CMAKE_INCLUDE_CURRENT_DIR ON)
414
415 include_directories( ${LLVM_BINARY_DIR}/include ${LLVM_MAIN_INCLUDE_DIR})
416
417 if( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD )
418   # On FreeBSD, /usr/local/* is not used by default. In order to build LLVM
419   # with libxml2, iconv.h, etc., we must add /usr/local paths.
420   include_directories("/usr/local/include")
421   link_directories("/usr/local/lib")
422 endif( ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD )
423
424 if( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
425    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -include llvm/Support/Solaris.h")
426 endif( ${CMAKE_SYSTEM_NAME} MATCHES SunOS )
427
428 # Make sure we don't get -rdynamic in every binary. For those that need it,
429 # use set_target_properties(target PROPERTIES ENABLE_EXPORTS 1)
430 set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
431
432 include(AddLLVM)
433 include(TableGen)
434
435 if( MINGW )
436   # People report that -O3 is unreliable on MinGW. The traditional
437   # build also uses -O2 for that reason:
438   llvm_replace_compiler_option(CMAKE_CXX_FLAGS_RELEASE "-O3" "-O2")
439 endif()
440
441 # Put this before tblgen. Else we have a circular dependence.
442 add_subdirectory(lib/Support)
443 add_subdirectory(lib/TableGen)
444
445 add_subdirectory(utils/TableGen)
446
447 add_subdirectory(include/llvm)
448
449 add_subdirectory(lib)
450
451 add_subdirectory(utils/FileCheck)
452 add_subdirectory(utils/FileUpdate)
453 add_subdirectory(utils/count)
454 add_subdirectory(utils/not)
455 add_subdirectory(utils/llvm-lit)
456 add_subdirectory(utils/yaml-bench)
457
458 add_subdirectory(projects)
459
460 if( LLVM_INCLUDE_TOOLS )
461   add_subdirectory(tools)
462 endif()
463
464 if( LLVM_INCLUDE_EXAMPLES )
465   add_subdirectory(examples)
466 endif()
467
468 if( LLVM_INCLUDE_TESTS )
469   add_subdirectory(test)
470   add_subdirectory(utils/unittest)
471   add_subdirectory(unittests)
472   if (MSVC)
473     # This utility is used to prevent crashing tests from calling Dr. Watson on
474     # Windows.
475     add_subdirectory(utils/KillTheDoctor)
476   endif()
477
478   # Add a global check rule now that all subdirectories have been traversed
479   # and we know the total set of lit testsuites.
480   get_property(LLVM_LIT_TESTSUITES GLOBAL PROPERTY LLVM_LIT_TESTSUITES)
481   get_property(LLVM_LIT_PARAMS GLOBAL PROPERTY LLVM_LIT_PARAMS)
482   get_property(LLVM_LIT_DEPENDS GLOBAL PROPERTY LLVM_LIT_DEPENDS)
483   get_property(LLVM_LIT_EXTRA_ARGS GLOBAL PROPERTY LLVM_LIT_EXTRA_ARGS)
484   add_lit_target(check-all
485     "Running all regression tests"
486     ${LLVM_LIT_TESTSUITES}
487     PARAMS ${LLVM_LIT_PARAMS}
488     DEPENDS ${LLVM_LIT_DEPENDS}
489     ARGS ${LLVM_LIT_EXTRA_ARGS}
490     )
491 endif()
492
493 if (LLVM_INCLUDE_DOCS)
494   add_subdirectory(docs)
495 endif()
496
497 add_subdirectory(cmake/modules)
498
499 if (NOT LLVM_INSTALL_TOOLCHAIN_ONLY)
500   install(DIRECTORY include/
501     DESTINATION include
502     FILES_MATCHING
503     PATTERN "*.def"
504     PATTERN "*.h"
505     PATTERN "*.td"
506     PATTERN "*.inc"
507     PATTERN "LICENSE.TXT"
508     PATTERN ".svn" EXCLUDE
509     )
510
511   install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/
512     DESTINATION include
513     FILES_MATCHING
514     PATTERN "*.def"
515     PATTERN "*.h"
516     PATTERN "*.gen"
517     PATTERN "*.inc"
518     # Exclude include/llvm/CMakeFiles/intrinsics_gen.dir, matched by "*.def"
519     PATTERN "CMakeFiles" EXCLUDE
520     PATTERN ".svn" EXCLUDE
521     )
522 endif()
523
524 # Workaround for MSVS10 to avoid the Dialog Hell
525 # FIXME: This could be removed with future version of CMake.
526 if(MSVC_VERSION EQUAL 1600)
527   set(LLVM_SLN_FILENAME "${CMAKE_CURRENT_BINARY_DIR}/LLVM.sln")
528   if( EXISTS "${LLVM_SLN_FILENAME}" )
529     file(APPEND "${LLVM_SLN_FILENAME}" "\n# This should be regenerated!\n")
530   endif()
531 endif()
532