Index: libomptarget/CMakeLists.txt =================================================================== --- libomptarget/CMakeLists.txt +++ libomptarget/CMakeLists.txt @@ -94,8 +94,11 @@ # Build libomptarget library with libdl dependency. add_library(omptarget SHARED ${src_files}) + check_library_exists(dl dlopen "" HAVE_LIBDL) + if(HAVE_LIBDL) + target_link_libraries(omptarget dl) + endif() target_link_libraries(omptarget - dl "-Wl,--version-script=${CMAKE_CURRENT_SOURCE_DIR}/exports") # Install libomptarget under the lib destination folder.