Skip to content

Commit 74c0422

Browse files
authored
[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.
1 parent 39beeb8 commit 74c0422

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

clang/CMakeLists.txt

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -183,18 +183,17 @@ check_include_file(sys/resource.h CLANG_HAVE_RLIMITS)
183183
# This check requires _GNU_SOURCE on linux
184184
check_include_file(dlfcn.h CLANG_HAVE_DLFCN_H)
185185
if( CLANG_HAVE_DLFCN_H )
186+
include(CMakePushCheckState)
186187
include(CheckLibraryExists)
187188
include(CheckSymbolExists)
188189
check_library_exists(dl dlopen "" HAVE_LIBDL)
190+
cmake_push_check_state()
189191
if( HAVE_LIBDL )
190192
list(APPEND CMAKE_REQUIRED_LIBRARIES dl)
191193
endif()
192194
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
193195
check_symbol_exists(dladdr dlfcn.h CLANG_HAVE_DLADDR)
194-
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
195-
if( HAVE_LIBDL )
196-
list(REMOVE_ITEM CMAKE_REQUIRED_LIBRARIES dl)
197-
endif()
196+
cmake_pop_check_state()
198197
endif()
199198

200199
set(CLANG_RESOURCE_DIR "" CACHE STRING

0 commit comments

Comments
 (0)