sgraenitz created this revision.
sgraenitz added reviewers: JDevlieghere, jingham, xiaobai, compnerd, labath.
Herald added a subscriber: mgorny.
Herald added a project: LLDB.
This shrinks standalone configuration lines by one more parameter. In the
provided build-tree, the default structure of CMake module directories is:
/path/to/build-llvm/lib/cmake/llvm
/paht/to/build-llvm/lib/cmake/clang
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D65798
Files:
lldb/cmake/modules/LLDBStandalone.cmake
lldb/docs/resources/build.rst
Index: lldb/docs/resources/build.rst
===================================================================
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -323,7 +323,6 @@
> cmake -B /path/to/lldb-build \
-C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
-DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
- -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
llvm-project/lldb
> open lldb.xcodeproj
> cmake --build /path/to/lldb-build --target check-lldb
Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,5 +1,12 @@
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the
'install' target." OFF)
+if(NOT Clang_DIR)
+ # ClangConfig.cmake is usually found in the clang directory
+ # next to LLVM's module directory.
+ set(Clang_DIR ${LLVM_DIR}/../clang)
+ message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")
+endif()
+
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)
Index: lldb/docs/resources/build.rst
===================================================================
--- lldb/docs/resources/build.rst
+++ lldb/docs/resources/build.rst
@@ -323,7 +323,6 @@
> cmake -B /path/to/lldb-build \
-C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake \
-DLLVM_DIR=/path/to/llvm-build/lib/cmake/llvm \
- -DClang_DIR=/path/to/llvm-build/lib/cmake/clang \
llvm-project/lldb
> open lldb.xcodeproj
> cmake --build /path/to/lldb-build --target check-lldb
Index: lldb/cmake/modules/LLDBStandalone.cmake
===================================================================
--- lldb/cmake/modules/LLDBStandalone.cmake
+++ lldb/cmake/modules/LLDBStandalone.cmake
@@ -1,5 +1,12 @@
option(LLVM_INSTALL_TOOLCHAIN_ONLY "Only include toolchain files in the 'install' target." OFF)
+if(NOT Clang_DIR)
+ # ClangConfig.cmake is usually found in the clang directory
+ # next to LLVM's module directory.
+ set(Clang_DIR ${LLVM_DIR}/../clang)
+ message(STATUS "Inferred Clang_DIR: ${Clang_DIR}")
+endif()
+
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)
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits