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.
This commit is contained in:
Thomas Klausner 2022-07-19 11:38:58 +02:00 committed by Vadim Zeitlin
parent 556868390f
commit 9efe21b55a
2 changed files with 2 additions and 2 deletions

View file

@ -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()

View file

@ -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)