[Lldb-commits] [lldb] r368066 - [lldb][CMake] Generating Xcode projects

Stefan Granitz via lldb-commits lldb-commits at lists.llvm.org
Tue Aug 6 10:21:34 PDT 2019


Author: stefan.graenitz
Date: Tue Aug  6 10:21:34 2019
New Revision: 368066

URL: http://llvm.org/viewvc/llvm-project?rev=368066&view=rev
Log:
[lldb][CMake] Generating Xcode projects

Summary:
Print a warning if the wrong cache script is used when generating a Xcode project, because it's too easy to confuse with Apple-lldb-macOS.cmake

```
  When building with Xcode, we recommend using the corresponding cache
  script.  If this was a mistake, clean your build directory and re-run
  CMake with:

    -C /path/to/llvm-project/lldb/cmake/caches/Apple-lldb-Xcode.cmake

  See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject
```

Also set the generator inside the cache script.

Reviewers: JDevlieghere, jingham, clayborg

Reviewed By: JDevlieghere

Subscribers: mgorny, lldb-commits, #lldb

Tags: #lldb

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

Modified:
    lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
    lldb/trunk/cmake/modules/LLDBConfig.cmake
    lldb/trunk/docs/resources/build.rst

Modified: lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake?rev=368066&r1=368065&r2=368066&view=diff
==============================================================================
--- lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake (original)
+++ lldb/trunk/cmake/caches/Apple-lldb-Xcode.cmake Tue Aug  6 10:21:34 2019
@@ -1,5 +1,11 @@
 include(${CMAKE_CURRENT_LIST_DIR}/Apple-lldb-base.cmake)
 
-set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+set(CMAKE_GENERATOR Xcode)
 set(CMAKE_OSX_DEPLOYMENT_TARGET 10.11 CACHE STRING "")
 set(CMAKE_XCODE_GENERATE_SCHEME ON CACHE BOOL "")
+
+set(LLDB_BUILD_FRAMEWORK ON CACHE BOOL "")
+
+# Print a warning with instructions, if we
+# build with Xcode and didn't use this cache.
+set(LLDB_EXPLICIT_XCODE_CACHE_USED ON CACHE INTERNAL "")

Modified: lldb/trunk/cmake/modules/LLDBConfig.cmake
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/cmake/modules/LLDBConfig.cmake?rev=368066&r1=368065&r2=368066&view=diff
==============================================================================
--- lldb/trunk/cmake/modules/LLDBConfig.cmake (original)
+++ lldb/trunk/cmake/modules/LLDBConfig.cmake Tue Aug  6 10:21:34 2019
@@ -71,6 +71,16 @@ if(LLDB_BUILD_FRAMEWORK)
       "Directory to emit dSYM files stripped from executables and libraries (Darwin Only)")
 endif()
 
+if(APPLE AND CMAKE_GENERATOR STREQUAL Xcode)
+  if(NOT LLDB_EXPLICIT_XCODE_CACHE_USED)
+    message(WARNING
+      "When building with Xcode, we recommend using the corresponding cache script. "
+      "If this was a mistake, clean your lean build directory and re-run CMake with:\n"
+      "  -C ${CMAKE_SOURCE_DIR}/cmake/caches/Apple-lldb-Xcode.cmake\n"
+      "See: https://lldb.llvm.org/resources/build.html#cmakegeneratedxcodeproject\n")
+  endif()
+endif()
+
 if (NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
   set(LLDB_EXPORT_ALL_SYMBOLS 0 CACHE BOOL
     "Causes lldb to export all symbols when building liblldb.")

Modified: lldb/trunk/docs/resources/build.rst
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/docs/resources/build.rst?rev=368066&r1=368065&r2=368066&view=diff
==============================================================================
--- lldb/trunk/docs/resources/build.rst (original)
+++ lldb/trunk/docs/resources/build.rst Tue Aug  6 10:21:34 2019
@@ -320,7 +320,7 @@ Build LLDB standalone for development wi
           llvm-project/llvm
   > ninja -C /path/to/llvm-build
 
-  > cmake -B /path/to/lldb-build -G Xcode \
+  > 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 \




More information about the lldb-commits mailing list