[CMake] Allow building standalone without any llvm-config available

This is the same as libcxxabi/libcxx do.

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

llvm-svn: 338819
This commit is contained in:
Martin Storsjo 2018-08-03 05:51:31 +00:00
parent d07bd75cb3
commit 5d108d260f
1 changed files with 8 additions and 5 deletions

View File

@ -66,9 +66,10 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm") set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
endif() endif()
else() else()
message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. " message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: "
"Reconfigure with -DLLVM_CONFIG=path/to/llvm-config " "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
"or -DLLVM_PATH=path/to/llvm-source-root.") "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
"or -DLLVM_PATH=path/to/llvm-source-root.")
endif() endif()
if (EXISTS ${LLVM_CMAKE_PATH}) if (EXISTS ${LLVM_CMAKE_PATH})
@ -76,7 +77,7 @@ if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
include("${LLVM_CMAKE_PATH}/AddLLVM.cmake") include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake") include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
else() else()
message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}") message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
endif() endif()
set(PACKAGE_NAME libunwind) set(PACKAGE_NAME libunwind)
@ -366,4 +367,6 @@ if (LIBUNWIND_INCLUDE_DOCS)
add_subdirectory(docs) add_subdirectory(docs)
endif() endif()
add_subdirectory(test) if (EXISTS ${LLVM_CMAKE_PATH})
add_subdirectory(test)
endif()