mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 11:26:22 +00:00
27 lines
754 B
CMake
27 lines
754 B
CMake
include(CMakePushCheckState)
|
|
include(CheckCXXSymbolExists)
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
if (MSVC)
|
|
set(Dlfcn_FOUND FALSE)
|
|
unset(Dlfcn_LIBRARIES CACHE)
|
|
elseif (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
|
|
)
|