diff --git a/CMakeLists.txt b/CMakeLists.txt index 29a3edf..9eeef49 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,7 @@ cmake_minimum_required(VERSION 3.5) -# Set extension name here +# Set extension details set(TARGET_NAME httpserver) - -# DuckDB's extension distribution supports vcpkg. As such, dependencies can be added in ./vcpkg.json and then -# used in cmake with find_package. Feel free to remove or replace with other dependencies. -# Note that it should also be removed from vcpkg.json to prevent needlessly installing it.. -find_package(OpenSSL REQUIRED) - set(EXTENSION_NAME ${TARGET_NAME}_extension) set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension) @@ -20,21 +14,21 @@ if(MINGW) set(OPENSSL_USE_STATIC_LIBS TRUE) endif() +# Find OpenSSL before building extensions +find_package(OpenSSL REQUIRED) + build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES}) build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES}) -# Link OpenSSL in both the static library as the loadable extension include_directories(${OPENSSL_INCLUDE_DIR}) -target_link_libraries(${EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto) -target_link_libraries(${LOADABLE_EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto) -target_link_libraries(${LOADABLE_EXTENSION_NAME} duckdb_mbedtls - ${OPENSSL_LIBRARIES}) +target_link_libraries(${LOADABLE_EXTENSION_NAME} duckdb_mbedtls ${OPENSSL_LIBRARIES}) target_link_libraries(${EXTENSION_NAME} duckdb_mbedtls ${OPENSSL_LIBRARIES}) if(MINGW) + set(WIN_LIBS crypt32 ws2_32 wsock32) find_package(ZLIB) - target_link_libraries(${LOADABLE_EXTENSION_NAME} ZLIB::ZLIB -lcrypt32) - target_link_libraries(${EXTENSION_NAME} ZLIB::ZLIB -lcrypt32) + target_link_libraries(${LOADABLE_EXTENSION_NAME} ZLIB::ZLIB ${WIN_LIBS}) + target_link_libraries(${EXTENSION_NAME} ZLIB::ZLIB ${WIN_LIBS}) endif() install(