3
0
Fork 0
mirror of https://github.com/YosysHQ/yosys synced 2026-05-25 03:16:22 +00:00
yosys/cmake/FindDlfcn.cmake
Catherine 9b087b4aa7 Migrate build system to CMake
See #5895 for details.

This commit does not include CI or documentation changes.
2026-05-23 03:48:24 +00:00

24 lines
686 B
CMake

include(CMakePushCheckState)
include(CheckCXXSymbolExists)
include(FindPackageHandleStandardArgs)
if (WIN32 OR MSYS)
# Windows; dlopen is available via a polyfill `libs/dlfcn-win32`.
set(Dlfcn_LIBRARIES dlfcn)
else()
# Unix and Wasm; dlopen may or may not be available depending on platform.
cmake_push_check_state(RESET)
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_DL_LIBS})
check_cxx_symbol_exists(dlopen "dlfcn.h" HAVE_DLOPEN)
cmake_pop_check_state()
if (HAVE_DLOPEN)
add_library(dlfcn INTERFACE)
target_link_libraries(dlfcn INTERFACE ${CMAKE_DL_LIBS})
set(Dlfcn_LIBRARIES dlfcn)
endif()
endif()
find_package_handle_standard_args(Dlfcn
REQUIRED_VARS Dlfcn_LIBRARIES
)