[PATCH] D32577: CMake: Replace open-coded find_package

NAKAMURA Takumi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 27 05:02:15 PDT 2017


chapuni added a comment.

I have investigated what LLVMConfig.cmake actually provides.

With the installed tree, SRC_ROOT (LLVM_BUILD_MAIN_SRC_DIR) is not provided.
It shouldn't be included in installed LLVMConfig.cmake. Just "llvm-config --src-root" knows. And LLVM_MAIN_SRC_DIR should be CACHE, optional to be specified manually.

I suggest;

1. Invoke "llvm-config --cmakedir --src-root" if LLVM_CONFIG is specified. (may be removed in future) Do not override LLVM_MAIN_SRC_DIR if it is defined.
2. find_package(LLVM REQUIRED HINTS ${LLVM_CMAKE_PATH}). Without LLVM_CONFIG, CMake will seek LLVMConfig.cmake along CMake's search paths like -DCMAKE_PREFIX_PATH.
3. If LLVM_MAIN_SRC_DIR is unknown, invoke "llvm-config --src-root"

LLVM_MAIN_SRC_DIR is just required to build test tools in llvm/utils.


https://reviews.llvm.org/D32577





More information about the llvm-commits mailing list