Added code back to conditionally build libmicrohttpd -- but this time for macOS.

This commit is contained in:
casey langen 2019-01-25 10:00:47 -08:00
parent a181e3d56a
commit 208c1a04de

View File

@ -22,15 +22,34 @@ set (server_LINK_LIBS ${BOOST_LINK_LIBS})
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include") include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/include")
set(EXTRA_LIBS "")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(EXTRA_LIBS "gnutls")
endif()
if (${LINK_STATICALLY} MATCHES "true") if (${LINK_STATICALLY} MATCHES "true")
# prefer static libraries on mac to make redist easier # libmicrohttpd on macOS now depends on `gnutls`. when we build statically,
find_library(MICROHTTPDLIB NAMES libmicrohttpd.a microhttpd) # we also need to build libmicrohttpd ourselves and disable TLS to avoid this
target_link_libraries(server ${server_LINK_LIBS} ${MICROHTTPDLIB} z ${EXTRA_LIBS}) # homebrew-only dependency
set(EXTRA_OBJS "")
set(MICROHTTPDLIB "")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
include (ExternalProject)
ExternalProject_Add(libmicrohttpd
URL https://ftp.gnu.org/gnu/libmicrohttpd/libmicrohttpd-0.9.62.tar.gz
BUILD_IN_SOURCE 1
CONFIGURE_COMMAND ./configure --enable-https=no --disable-curl --prefix=${CMAKE_CURRENT_SOURCE_DIR}/microhttpd/
BUILD_COMMAND make
INSTALL_COMMAND make install
TEST_COMMAND "")
add_dependencies(server libmicrohttpd)
include_directories ("${CMAKE_CURRENT_SOURCE_DIR}/microhttpd/include")
file(GLOB EXTRA_OBJS "${CMAKE_CURRENT_SOURCE_DIR}/libmicrohttpd-prefix/src/libmicrohttpd/src/microhttpd/.libs/*.o")
else()
find_library(MICROHTTPDLIB NAMES libmicrohttpd.a microhttpd)
endif()
target_link_libraries(server ${server_LINK_LIBS} ${MICROHTTPDLIB} z ${EXTRA_OBJS})
else() else()
set(EXTRA_LIBS "")
if (CMAKE_SYSTEM_NAME MATCHES "Darwin")
set(EXTRA_LIBS "gnutls")
endif()
target_link_libraries(server ${server_LINK_LIBS} microhttpd z ${EXTRA_LIBS}) target_link_libraries(server ${server_LINK_LIBS} microhttpd z ${EXTRA_LIBS})
endif() endif()