33 lines
1.2 KiB
Diff
33 lines
1.2 KiB
Diff
From 395d7bb45ee49802a5c195b979b021d2c31c6df8 Mon Sep 17 00:00:00 2001
|
|
From: Jeremy Drake <github@jdrake.com>
|
|
Date: Mon, 5 May 2025 14:11:44 -0700
|
|
Subject: [PATCH] [CMake] respect LLVMConfig.cmake's LLVM_DEFINITIONS
|
|
|
|
In #138329, _GNU_SOURCE was added for Cygwin, but when building Clang
|
|
standalone against an installed LLVM this definition was not picked up,
|
|
resulting in undefined strnlen. Follow the documentation in
|
|
https://llvm.org/docs/CMake.html#developing-llvm-passes-out-of-source
|
|
and add the LLVM_DEFINITIONS in standalone projects' cmakes.
|
|
---
|
|
clang/CMakeLists.txt | 4 ++++
|
|
1 file changed, 4 insertions(+)
|
|
|
|
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
|
|
index fb309c369f..ac7feb6078 100644
|
|
--- a/clang/CMakeLists.txt
|
|
+++ b/clang/CMakeLists.txt
|
|
@@ -68,6 +68,10 @@ if(CLANG_BUILT_STANDALONE)
|
|
option(CLANG_ENABLE_BOOTSTRAP "Generate the clang bootstrap target" OFF)
|
|
option(LLVM_ENABLE_LIBXML2 "Use libxml2 if available." ON)
|
|
|
|
+ separate_arguments(LLVM_DEFINITIONS_LIST NATIVE_COMMAND ${LLVM_DEFINITIONS})
|
|
+ add_definitions(${LLVM_DEFINITIONS_LIST})
|
|
+ list(APPEND CMAKE_REQUIRED_DEFINITIONS ${LLVM_DEFINITIONS_LIST})
|
|
+
|
|
include(AddLLVM)
|
|
include(TableGen)
|
|
include(HandleLLVMOptions)
|
|
--
|
|
2.50.1.windows.1
|
|
|