[Lldb-commits] [lldb] r360756 - [CMake] Add error to clarify that lldb requires libcxx

Stefan Granitz via lldb-commits lldb-commits at lists.llvm.org
Wed May 15 01:59:02 PDT 2019


Author: stefan.graenitz
Date: Wed May 15 01:59:02 2019
New Revision: 360756

URL: http://llvm.org/viewvc/llvm-project?rev=360756&view=rev
Log:
[CMake] Add error to clarify that lldb requires libcxx

Summary:
This adds a specific error message to clarify that lldb requires libcxx when
built together with clang on macOS. In addition, the lldb building docs are also
updated.

Fixes https://bugs.llvm.org/show_bug.cgi?id=41866

Reviewers: sgraenitz, JDevlieghere, EricWF

Reviewed By: sgraenitz

Subscribers: mgorny, lldb-commits

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D61877

Modified:
    lldb/trunk/CMakeLists.txt
    lldb/trunk/docs/resources/build.rst

Modified: lldb/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/CMakeLists.txt?rev=360756&r1=360755&r2=360756&view=diff
==============================================================================
--- lldb/trunk/CMakeLists.txt (original)
+++ lldb/trunk/CMakeLists.txt Wed May 15 01:59:02 2019
@@ -124,6 +124,24 @@ if(LLDB_INCLUDE_TESTS)
           message(WARNING "LLDB test suite requires libc++ in llvm/projects/libcxx or an existing build symlinked to ${cxx_dir}")
         endif()
       else()
+        # We require libcxx for the test suite, so if we aren't building it,
+        # try to provide a helpful error about how to resolve the situation.
+        if(NOT TARGET cxx)
+          if(LLVM_ENABLE_PROJECTS STREQUAL "")
+            # If `LLVM_ENABLE_PROJECTS` is not being used (implying that we are
+            # using the old layout), suggest checking it out.
+            message(FATAL_ERROR
+              "LLDB test suite requires libc++, but it is currently disabled. "
+              "Please checkout `libcxx` in `llvm/projects` or disable tests "
+              "via `LLDB_INCLUDE_TESTS=OFF`.")
+          else()
+            # If `LLVM_ENABLE_PROJECTS` is being used, suggest adding it.
+            message(FATAL_ERROR
+              "LLDB test suite requires libc++, but it is currently disabled. "
+              "Please add `libcxx` to `LLVM_ENABLE_PROJECTS` or disable tests "
+              "via `LLDB_INCLUDE_TESTS=OFF`.")
+          endif()
+        endif()
         list(APPEND LLDB_TEST_DEPS cxx)
       endif()
     endif()

Modified: lldb/trunk/docs/resources/build.rst
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=360756&r1=360755&r2=360756&view=diff
==============================================================================
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Wed May 15 01:59:02 2019
@@ -151,6 +151,12 @@ variables to cmake to change build behav
 LLVM, then you can pass LLVM-specific CMake variables to cmake when building
 LLDB.
 
+If you are building both Clang and LLDB together, be sure to also add libc++,
+which is currently required for testing on macOS:
+
+::
+
+  > cmake -D LLVM_ENABLE_PROJECTS='clang;lldb;libcxx' $PATH_TO_LLVM -G Ninja
 
 Here are some commonly used LLDB-specific CMake variables:
 




More information about the lldb-commits mailing list