Skip to content

Commit e0e16f2

Browse files
authored
Attempt winsock fix for MINGW
1 parent 3b859d6 commit e0e16f2

File tree

1 file changed

+8
-14
lines changed

1 file changed

+8
-14
lines changed

CMakeLists.txt

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
11
cmake_minimum_required(VERSION 3.5)
22

3-
# Set extension name here
3+
# Set extension details
44
set(TARGET_NAME httpserver)
5-
6-
# DuckDB's extension distribution supports vcpkg. As such, dependencies can be added in ./vcpkg.json and then
7-
# used in cmake with find_package. Feel free to remove or replace with other dependencies.
8-
# Note that it should also be removed from vcpkg.json to prevent needlessly installing it..
9-
find_package(OpenSSL REQUIRED)
10-
115
set(EXTENSION_NAME ${TARGET_NAME}_extension)
126
set(LOADABLE_EXTENSION_NAME ${TARGET_NAME}_loadable_extension)
137

@@ -20,21 +14,21 @@ if(MINGW)
2014
set(OPENSSL_USE_STATIC_LIBS TRUE)
2115
endif()
2216

17+
# Find OpenSSL before building extensions
18+
find_package(OpenSSL REQUIRED)
19+
2320
build_static_extension(${TARGET_NAME} ${EXTENSION_SOURCES})
2421
build_loadable_extension(${TARGET_NAME} " " ${EXTENSION_SOURCES})
2522

26-
# Link OpenSSL in both the static library as the loadable extension
2723
include_directories(${OPENSSL_INCLUDE_DIR})
28-
target_link_libraries(${EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto)
29-
target_link_libraries(${LOADABLE_EXTENSION_NAME} OpenSSL::SSL OpenSSL::Crypto)
30-
target_link_libraries(${LOADABLE_EXTENSION_NAME} duckdb_mbedtls
31-
${OPENSSL_LIBRARIES})
24+
target_link_libraries(${LOADABLE_EXTENSION_NAME} duckdb_mbedtls ${OPENSSL_LIBRARIES})
3225
target_link_libraries(${EXTENSION_NAME} duckdb_mbedtls ${OPENSSL_LIBRARIES})
3326

3427
if(MINGW)
28+
set(WIN_LIBS crypt32 ws2_32 wsock32)
3529
find_package(ZLIB)
36-
target_link_libraries(${LOADABLE_EXTENSION_NAME} ZLIB::ZLIB -lcrypt32)
37-
target_link_libraries(${EXTENSION_NAME} ZLIB::ZLIB -lcrypt32)
30+
target_link_libraries(${LOADABLE_EXTENSION_NAME} ZLIB::ZLIB ${WIN_LIBS})
31+
target_link_libraries(${EXTENSION_NAME} ZLIB::ZLIB ${WIN_LIBS})
3832
endif()
3933

4034
install(

0 commit comments

Comments
 (0)