MSYS2-packages/llvm/0112-Clang-CMake-use-CMakePushCheckState-138783.patch
2025-07-09 17:24:53 -07:00

41 lines
1.3 KiB
Diff

From 042ceda63c88b89c6d4024f2f51f3c3d5c81798c Mon Sep 17 00:00:00 2001
From: jeremyd2019 <github@jdrake.com>
Date: Wed, 7 May 2025 12:17:54 -0700
Subject: [PATCH] [Clang][CMake] use CMakePushCheckState (#138783)
The previous approach of using list(REMOVE ...) would remove *all*
occurences of the given item, not just the one appended above.
---
clang/CMakeLists.txt | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/clang/CMakeLists.txt b/clang/CMakeLists.txt
index 24e656eced..fb309c369f 100644
--- a/clang/CMakeLists.txt
+++ b/clang/CMakeLists.txt
@@ -183,18 +183,17 @@ check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
# This check requires _GNU_SOURCE on linux
check_include_file(dlfcn.h CLANG_HAVE_DLFCN_H)
if( CLANG_HAVE_DLFCN_H )
+ include(CMakePushCheckState)
include(CheckLibraryExists)
include(CheckSymbolExists)
check_library_exists(dl dlopen "" HAVE_LIBDL)
+ cmake_push_check_state()
if( HAVE_LIBDL )
list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
check_symbol_exists(dladdr dlfcn.h CLANG_HAVE_DLADDR)
- list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
- if( HAVE_LIBDL )
- list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl)
- endif()
+ cmake_pop_check_state()
endif()
set(CLANG_RESOURCE_DIR "" CACHE STRING
--
2.50.1.windows.1