Page MenuHomePhabricator

[CMake] Use LLVM_DIR and Clang_DIR for standalone builds.

Authored by JDevlieghere on Jul 16 2019, 2:33 PM.



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:


  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

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. I propose removing LLDB_PATH_TO_LLVM_BUILD and LLDB_PATH_TO_CLANG_BUILD and use LLVM_DIR and Clang_DIR respectively.

Diff Detail


Event Timeline

JDevlieghere created this revision.Jul 16 2019, 2:33 PM
Herald added a project: Restricted Project. · View Herald TranscriptJul 16 2019, 2:33 PM
Herald added a subscriber: abidh. · View Herald Transcript
sgraenitz requested changes to this revision.Jul 17 2019, 5:01 AM

We shouldn't do the sole change here, but instead remove all LLDB_PATH_TO_<xy>_BUILD variables in favor of CMake standard <package>_DIR variables. Summarizing a discussion on this a while ago:

LLDB_PATH_TO_LLVM_BUILD used to be something like /path/to/llvm-build-tree
LLVM_DIR, however, is /path/to/llvm-build-tree/lib/cmake/llvm. Fine so far, but initializing..
LLDB_PATH_TO_CLANG_BUILD with the same value is incorrect, because it should be /path/to/llvm-build-tree/lib/cmake/clang!

In the past we also had (and downstream still have) things that would break, like:


Fortunately most of it was cleaned up in the meantime. It looks like the only remaining blocker is the one below.

45 ↗(On Diff #210181)

@xiaobai Can this be changed to something like ${LLVM_DIR}/../../../NATIVE?

This revision now requires changes to proceed.Jul 17 2019, 5:01 AM
xiaobai added inline comments.Jul 17 2019, 11:10 AM
45 ↗(On Diff #210181)

Yeah I don't see why not. We could probably even change it to ${LLVM_BINARY_DIR}/NATIVE instead.

Use LLVM_DIR and Clang_DIR

JDevlieghere retitled this revision from [CMake] Default LLDB_PATH_TO_LLVM_BUILD to LLVM_DIR to [CMake] Use LLVM_DIR and Clang_DIR for standalone builds..Jul 17 2019, 11:32 AM
JDevlieghere edited the summary of this revision. (Show Details)
sgraenitz accepted this revision.Jul 17 2019, 11:59 AM
This revision is now accepted and ready to land.Jul 17 2019, 11:59 AM
This revision was automatically updated to reflect the committed changes.
Herald added a project: Restricted Project. · View Herald TranscriptJul 17 2019, 12:29 PM