[compiler-rt] Add option to disable libc++ build

Having libc++ checked out doesn't necessarily mean it should be built;
for example, the same source tree might be used for multiple build
configurations, and libc++ might not build in some of those
configurations. Add an option to compiler-rt's build to disable building
libc++. This defaults to ON, so it shouldn't change any existing build
configurations.

Differential Revision: https://reviews.llvm.org/D56479

llvm-svn: 351117
This commit is contained in:
Shoaib Meenai 2019-01-14 20:33:30 +00:00
parent 58c6504543
commit 6e39af016f
1 changed files with 13 additions and 9 deletions

View File

@ -428,15 +428,19 @@ endif()
add_subdirectory(include) add_subdirectory(include)
foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx option(COMPILER_RT_USE_LIBCXX
${LLVM_MAIN_SRC_DIR}/runtimes/libcxx "Enable compiler-rt to use libc++ from the source tree" ON)
${LLVM_MAIN_SRC_DIR}/../libcxx if(COMPILER_RT_USE_LIBCXX)
${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR}) foreach(path IN ITEMS ${LLVM_MAIN_SRC_DIR}/projects/libcxx
if(IS_DIRECTORY ${path}) ${LLVM_MAIN_SRC_DIR}/runtimes/libcxx
set(COMPILER_RT_LIBCXX_PATH ${path}) ${LLVM_MAIN_SRC_DIR}/../libcxx
break() ${LLVM_EXTERNAL_LIBCXX_SOURCE_DIR})
endif() if(IS_DIRECTORY ${path})
endforeach() set(COMPILER_RT_LIBCXX_PATH ${path})
break()
endif()
endforeach()
endif()
set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld) set(COMPILER_RT_LLD_PATH ${LLVM_MAIN_SRC_DIR}/tools/lld)
if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD) if(EXISTS ${COMPILER_RT_LLD_PATH}/ AND LLVM_TOOL_LLD_BUILD)