1 if (NOT DEFINED LLVM_PATH)
2 set(LLVM_PATH ${CMAKE_CURRENT_LIST_DIR}/../../../llvm CACHE PATH "" FORCE)
5 if(NOT IS_DIRECTORY ${LLVM_PATH})
7 "The provided LLVM_PATH (${LLVM_PATH}) is not a valid directory. Note that "
8 "building libc++ outside of the monorepo is not supported anymore. Please "
9 "use a Standalone build against the monorepo, a Runtimes build or a classic "
13 set(LLVM_INCLUDE_DIR ${LLVM_PATH}/include CACHE PATH "Path to llvm/include")
14 set(LLVM_PATH ${LLVM_PATH} CACHE PATH "Path to LLVM source tree")
15 set(LLVM_MAIN_SRC_DIR ${LLVM_PATH})
16 set(LLVM_CMAKE_PATH "${LLVM_PATH}/cmake/modules")
18 if (EXISTS "${LLVM_CMAKE_PATH}")
19 list(APPEND CMAKE_MODULE_PATH "${LLVM_CMAKE_PATH}")
20 elseif (EXISTS "${LLVM_MAIN_SRC_DIR}/cmake/modules")
21 list(APPEND CMAKE_MODULE_PATH "${LLVM_MAIN_SRC_DIR}/cmake/modules")
23 message(FATAL_ERROR "Neither ${LLVM_CMAKE_PATH} nor ${LLVM_MAIN_SRC_DIR}/cmake/modules found. "
24 "This is not a supported configuration.")
27 message(STATUS "Configuring for standalone build.")
29 # Add LLVM Functions --------------------------------------------------------
38 include(AddLLVM OPTIONAL)
40 # LLVM Options --------------------------------------------------------------
41 if (NOT DEFINED LLVM_INCLUDE_TESTS)
42 set(LLVM_INCLUDE_TESTS ON)
44 if (NOT DEFINED LLVM_INCLUDE_DOCS)
45 set(LLVM_INCLUDE_DOCS ON)
47 if (NOT DEFINED LLVM_ENABLE_SPHINX)
48 set(LLVM_ENABLE_SPHINX OFF)
51 if (LLVM_INCLUDE_TESTS)
52 # Required LIT Configuration ------------------------------------------------
53 # Define the default arguments to use with 'lit', and an option for the user
55 set(LLVM_DEFAULT_EXTERNAL_LIT "${LLVM_MAIN_SRC_DIR}/utils/lit/lit.py")
56 set(LIT_ARGS_DEFAULT "-sv --show-xfail --show-unsupported")
58 set(LIT_ARGS_DEFAULT "${LIT_ARGS_DEFAULT} --no-progress-bar")
60 set(LLVM_LIT_ARGS "${LIT_ARGS_DEFAULT}" CACHE STRING "Default options for lit")
63 # Required doc configuration
64 if (LLVM_ENABLE_SPHINX)
65 find_package(Sphinx REQUIRED)
68 if (LLVM_ON_UNIX AND NOT APPLE)
69 set(LLVM_HAVE_LINK_VERSION_SCRIPT 1)
71 set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)