[Lldb-commits] [lldb] [llvm] Define -DLLVM_BUILD_TELEMETRY to be used in ifdef (PR #126746)

via lldb-commits lldb-commits at lists.llvm.org
Tue Feb 11 10:08:06 PST 2025


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-lldb

Author: Vy Nguyen (oontvoo)

<details>
<summary>Changes</summary>

Background: 

Telemetry code isn't always built (controlled by this LLVM_BUILD_TELEMETRY cmake flag)
This means users of the library may not have the library. So we're definding the `-DLLVM_BUILD_TELEMETRY` to be used in ifdef.

---
Full diff: https://github.com/llvm/llvm-project/pull/126746.diff


3 Files Affected:

- (modified) lldb/source/Core/CMakeLists.txt (-1) 
- (modified) llvm/include/llvm/Config/llvm-config.h.cmake (+3) 
- (modified) llvm/lib/CMakeLists.txt (+1) 


``````````diff
diff --git a/lldb/source/Core/CMakeLists.txt b/lldb/source/Core/CMakeLists.txt
index cf5f6ac9da4894a..82fb5f42f9f4b9e 100644
--- a/lldb/source/Core/CMakeLists.txt
+++ b/lldb/source/Core/CMakeLists.txt
@@ -18,7 +18,6 @@ endif()
 
 if (LLVM_BUILD_TELEMETRY)
    set(TELEMETRY_DEPS Telemetry)
-   add_definitions(-DLLDB_BUILD_TELEMETRY)
 endif()
 
 # TODO: Add property `NO_PLUGIN_DEPENDENCIES` to lldbCore
diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake
index 629977cc11d6836..239f9dd3f38db18 100644
--- a/llvm/include/llvm/Config/llvm-config.h.cmake
+++ b/llvm/include/llvm/Config/llvm-config.h.cmake
@@ -201,4 +201,7 @@
 /* Define if logf128 is available */
 #cmakedefine LLVM_HAS_LOGF128
 
+/* Define if building LLVM with LLVM_BUILD_TELEMETRY */
+#cmakedefine LLVM_BUILD_TELEMETRY ${LLVM_BUILD_TELEMETRY}
+
 #endif
diff --git a/llvm/lib/CMakeLists.txt b/llvm/lib/CMakeLists.txt
index d0a2bc929438179..08e3d7ddb8c12c7 100644
--- a/llvm/lib/CMakeLists.txt
+++ b/llvm/lib/CMakeLists.txt
@@ -43,6 +43,7 @@ add_subdirectory(TargetParser)
 add_subdirectory(TextAPI)
 if (LLVM_BUILD_TELEMETRY)
   add_subdirectory(Telemetry)
+  add_definitions(-DLLDB_BUILD_TELEMETRY)
 endif()
 add_subdirectory(ToolDrivers)
 add_subdirectory(XRay)

``````````

</details>


https://github.com/llvm/llvm-project/pull/126746


More information about the lldb-commits mailing list