+cmake_minimum_required(VERSION 2.8.12.2)
+
+if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
+ message(STATUS "No build type selected, default to Debug")
+ set(CMAKE_BUILD_TYPE "Debug")
+endif()
+
+if(POLICY CMP0022)
+ cmake_policy(SET CMP0022 NEW) # automatic when 2.8.12 is required
+endif()
+
+if (POLICY CMP0051)
+ # CMake 3.1 and higher include generator expressions of the form
+ # $<TARGETLIB:obj> in the SOURCES property. These need to be
+ # stripped everywhere that access the SOURCES property, so we just
+ # defer to the OLD behavior of not including generator expressions
+ # in the output for now.
+ cmake_policy(SET CMP0051 OLD)
+endif()
+
+if(CMAKE_VERSION VERSION_LESS 3.1.20141117)
+ set(cmake_3_2_USES_TERMINAL)
+else()
+ set(cmake_3_2_USES_TERMINAL USES_TERMINAL)
+endif()
+
+project(LLVM C CXX ASM)
+
+# The following only works with the Ninja generator in CMake >= 3.0.
+set(LLVM_PARALLEL_COMPILE_JOBS "" CACHE STRING
+ "Define the maximum number of concurrent compilation jobs.")
+if(LLVM_PARALLEL_COMPILE_JOBS)
+ if(CMAKE_VERSION VERSION_LESS 3.0 OR NOT CMAKE_MAKE_PROGRAM MATCHES "ninja$")
+ message(WARNING "Job pooling is only available with Ninja generators and CMake 3.0 and later.")
+ else()
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS compile_job_pool=${LLVM_PARALLEL_COMPILE_JOBS})
+ set(CMAKE_JOB_POOL_COMPILE compile_job_pool)
+ endif()
+endif()
+
+set(LLVM_PARALLEL_LINK_JOBS "" CACHE STRING
+ "Define the maximum number of concurrent link jobs.")
+if(LLVM_PARALLEL_LINK_JOBS)
+ if(CMAKE_VERSION VERSION_LESS 3.0 OR NOT CMAKE_MAKE_PROGRAM MATCHES "ninja$")
+ message(WARNING "Job pooling is only available with Ninja generators and CMake 3.0 and later.")
+ else()
+ set_property(GLOBAL APPEND PROPERTY JOB_POOLS link_job_pool=${LLVM_PARALLEL_LINK_JOBS})
+ set(CMAKE_JOB_POOL_LINK link_job_pool)
+ endif()
+endif()