Skip to content

Commit

Permalink
build: Fix check dlopen
Browse files Browse the repository at this point in the history
Signed-off-by: Jianhui Zhao <zhaojh329@gmail.com>
  • Loading branch information
zhaojh329 committed Apr 5, 2020
1 parent b4adc20 commit 44b35fd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -2,6 +2,8 @@ cmake_minimum_required(VERSION 2.8)

project(libuhttpd C)

INCLUDE(CheckLibraryExists)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake/Modules/")

add_subdirectory(src)
Expand Down
9 changes: 4 additions & 5 deletions src/CMakeLists.txt
Expand Up @@ -8,15 +8,14 @@ set(UHTTPD_VERSION_PATCH 2)

# Check the third party Libraries
find_package(Libev REQUIRED)
find_library(LIBDL dl)

include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/buffer ${CMAKE_CURRENT_BINARY_DIR} ${LIBEV_INCLUDE_DIR})

set(EXTRA_LIBS ${LIBEV_LIBRARY} m)

if(NOT ${LIBDL} STREQUAL "LIBDL-NOTFOUND")
message(STATUS "Found Libdl: ${LIBDL}")
list(APPEND EXTRA_LIBS ${LIBDL})
check_library_exists(dl dlopenx "" HAVE_DLOPEN)
if(HAVE_DLOPEN)
list(APPEND EXTRA_LIBS dl)
add_definitions(-DHAVE_DLOPEN)
endif()

Expand Down Expand Up @@ -108,7 +107,7 @@ target_link_libraries(uhttpd_s ${EXTRA_LIBS})
# configure a header file to pass some of the CMake settings to the source code
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h)

if(NOT ${LIBDL} STREQUAL "LIBDL-NOTFOUND")
if(HAVE_DLOPEN)
add_subdirectory(plugins)
endif()

Expand Down

0 comments on commit 44b35fd

Please sign in to comment.