[CMake] Allow building standalone without any llvm-config available
This is the same as libcxxabi/libcxx do.
Differential Revision: https://reviews.llvm.org/D50135
git-svn-id: https://llvm.org/svn/llvm-project/libunwind/trunk@338819 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 381a275..d73c0dd 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,9 +66,10 @@
set(LLVM_CMAKE_PATH "${LLVM_BINARY_DIR_CMAKE_STYLE}/lib${LLVM_LIBDIR_SUFFIX}/cmake/llvm")
endif()
else()
- message(FATAL_ERROR "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
- "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
- "or -DLLVM_PATH=path/to/llvm-source-root.")
+ message(WARNING "UNSUPPORTED LIBUNWIND CONFIGURATION DETECTED: "
+ "llvm-config not found and LLVM_MAIN_SRC_DIR not defined. "
+ "Reconfigure with -DLLVM_CONFIG=path/to/llvm-config "
+ "or -DLLVM_PATH=path/to/llvm-source-root.")
endif()
if (EXISTS ${LLVM_CMAKE_PATH})
@@ -76,7 +77,7 @@
include("${LLVM_CMAKE_PATH}/AddLLVM.cmake")
include("${LLVM_CMAKE_PATH}/HandleLLVMOptions.cmake")
else()
- message(FATAL_ERROR "Not found: ${LLVM_CMAKE_PATH}")
+ message(WARNING "Not found: ${LLVM_CMAKE_PATH}")
endif()
set(PACKAGE_NAME libunwind)
@@ -366,4 +367,6 @@
add_subdirectory(docs)
endif()
-add_subdirectory(test)
+if (EXISTS ${LLVM_CMAKE_PATH})
+ add_subdirectory(test)
+endif()