diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-17 19:24:15 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2019-07-17 19:24:15 +0000 |
commit | 1b1d1b18627830710aa88b91a646876186f727cc (patch) | |
tree | 64a093fef469ebd8e64b0860441d154647fd2936 | |
parent | 86bbe1833003d9c467c1087acdba20cd49acf160 (diff) |
[CMake] Use LLVM_DIR and Clang_DIR for standalone builds.
When doing a standalone build, without setting LLDB_PATH_TO_LLVM_BUILD
or LLDB_PATH_TO_CLANG_BUILD, you get the following error.
```
CMake Error at cmake/modules/LLDBStandalone.cmake:23 (find_package):
Could not find a package configuration file provided by "LLVM" with any of
the following names:
LLVMConfig.cmake
llvm-config.cmake
Add the installation prefix of "LLVM" to CMAKE_PREFIX_PATH or set
"LLVM_DIR" to a directory containing one of the above files. If "LLVM"
provides a separate development package or SDK, be sure it has been
installed.
```
This suggests setting LLVM_DIR to LLVM's install directory. However,
LLDBStandalone.cmake takes LLDB_PATH_TO_LLVM_BUILD as its hint. As
someone who isn't familiar with the standalone process, this is rather
confusing. This patch removes LLDB_PATH_TO_LLVM_BUILD and
LLDB_PATH_TO_CLANG_BUILD and instead use LLVM_DIR and Clang_DIR
respectively.
Differential revision: https://reviews.llvm.org/D64823
git-svn-id: https://llvm.org/svn/llvm-project/lldb/trunk@366362 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | cmake/modules/LLDBStandalone.cmake | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/cmake/modules/LLDBStandalone.cmake b/cmake/modules/LLDBStandalone.cmake index 2d7ee2574..8d89f7c29 100644 --- a/cmake/modules/LLDBStandalone.cmake +++ b/cmake/modules/LLDBStandalone.cmake @@ -2,16 +2,8 @@ project(lldb) option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF) -set(LLDB_PATH_TO_LLVM_BUILD "" CACHE PATH "Path to LLVM build tree") -set(LLDB_PATH_TO_CLANG_BUILD "${LLDB_PATH_TO_LLVM_BUILD}" CACHE PATH "Path to Clang build tree") - -file(TO_CMAKE_PATH "${LLDB_PATH_TO_LLVM_BUILD}" LLDB_PATH_TO_LLVM_BUILD) -file(TO_CMAKE_PATH "${LLDB_PATH_TO_CLANG_BUILD}" LLDB_PATH_TO_CLANG_BUILD) - -find_package(LLVM REQUIRED CONFIG - HINTS "${LLDB_PATH_TO_LLVM_BUILD}" NO_CMAKE_FIND_ROOT_PATH) -find_package(Clang REQUIRED CONFIG - HINTS "${LLDB_PATH_TO_CLANG_BUILD}" NO_CMAKE_FIND_ROOT_PATH) +find_package(LLVM REQUIRED CONFIG HINTS "${LLVM_DIR}" NO_CMAKE_FIND_ROOT_PATH) +find_package(Clang REQUIRED CONFIG HINTS "${Clang_DIR}" NO_CMAKE_FIND_ROOT_PATH) # We set LLVM_CMAKE_PATH so that GetSVN.cmake is found correctly when building SVNVersion.inc set(LLVM_CMAKE_PATH ${LLVM_CMAKE_DIR} CACHE PATH "Path to LLVM CMake modules") @@ -40,7 +32,7 @@ find_program(lit_full_path ${lit_file_name} ${config_dirs} NO_DEFAULT_PATH) set(LLVM_DEFAULT_EXTERNAL_LIT ${lit_full_path} CACHE PATH "Path to llvm-lit") if(CMAKE_CROSSCOMPILING) - set(LLVM_NATIVE_BUILD "${LLDB_PATH_TO_LLVM_BUILD}/NATIVE") + set(LLVM_NATIVE_BUILD "${LLVM_BINARY_DIR}/NATIVE") if (NOT EXISTS "${LLVM_NATIVE_BUILD}") message(FATAL_ERROR "Attempting to cross-compile LLDB standalone but no native LLVM build |