+option(LLVM_ENABLE_THREADS "Use threads if available." ON)
+
+if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
+ option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
+else()
+ option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
+endif()
+
+if( LLVM_ENABLE_ASSERTIONS )
+ add_definitions( -D_DEBUG )
+ # On Release builds cmake automatically defines NDEBUG, so we
+ # explicitly undefine it:
+ if( uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
+ add_definitions( -UNDEBUG )
+ endif()
+else()
+ if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "RELEASE" )
+ add_definitions( -DNDEBUG )
+ endif()
+endif()
+
+if( LLVM_TARGETS_TO_BUILD STREQUAL "all" )
+ set( LLVM_TARGETS_TO_BUILD ${LLVM_ALL_TARGETS} )
+endif()
+
+set(LLVM_ENUM_TARGETS "")
+foreach(c ${LLVM_TARGETS_TO_BUILD})
+ list(FIND LLVM_ALL_TARGETS ${c} idx)
+ if( idx LESS 0 )
+ message(FATAL_ERROR "The target `${c}' does not exists.
+ It should be one of\n${LLVM_ALL_TARGETS}")
+ else()
+ set(LLVM_ENUM_TARGETS "${LLVM_ENUM_TARGETS}LLVM_TARGET(${c})\n")
+ endif()
+endforeach(c)
+
+# Produce llvm/Config/Targets.def
+configure_file(
+ ${LLVM_MAIN_INCLUDE_DIR}/llvm/Config/Targets.def.in
+ ${LLVM_BINARY_DIR}/include/llvm/Config/Targets.def
+ )