From 9efe21b55a162f970bbbc187c2127068fef5bd74 Mon Sep 17 00:00:00 2001 From: Thomas Klausner Date: Tue, 19 Jul 2022 11:38:58 +0200 Subject: [PATCH] Fix dlopen() detection in CMake under non-Linux systems. Linux (until recently) defined dlopen() in libdl, but some other operating systems (such as NetBSD) have it in libc. Use CMake-provided variable for the name of the library to use for dlopen() to fix NetBSD build. See #22644. --- build/cmake/lib/base/CMakeLists.txt | 2 +- build/cmake/setup.cmake | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/cmake/lib/base/CMakeLists.txt b/build/cmake/lib/base/CMakeLists.txt index cfa538fcb8..d8c587994b 100644 --- a/build/cmake/lib/base/CMakeLists.txt +++ b/build/cmake/lib/base/CMakeLists.txt @@ -65,5 +65,5 @@ if(APPLE) ) endif() elseif(UNIX) - wx_lib_link_libraries(wxbase PRIVATE dl) + wx_lib_link_libraries(wxbase PRIVATE ${CMAKE_DL_LIBS}) endif() diff --git a/build/cmake/setup.cmake b/build/cmake/setup.cmake index 2ec195fd5e..862fb35b7b 100644 --- a/build/cmake/setup.cmake +++ b/build/cmake/setup.cmake @@ -620,7 +620,7 @@ if(wxUSE_DATETIME) endif() cmake_push_check_state(RESET) -set(CMAKE_REQUIRED_LIBRARIES dl) +set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS}) check_symbol_exists(dlopen dlfcn.h HAVE_DLOPEN) cmake_pop_check_state() if(HAVE_DLOPEN)