ulfius
ulfius copied to clipboard
Ulfius failed to link microhttpd on mingw64 using CMake
Describe the issue
I'm trying to link ulfius to my cmake project on Windows. I would like to have ulfius sourcecode inside my libs/ folder, then let cmake compile using add_subdirectory(libs/ulfius) and directly linking target ulfius_static. It seems to works just fine except for microhttpd.
To Reproduce
I cloned ulfius inside libs/ folder, then I downloaded microhttpd-w32-bin.zip extracted the libmicrohttpd-0.9.77-w32-bin\x86_64\MinGW\static\mingw64 contents inside libs/. Then I copied an Ulfius example and compiled my porject using Cmake (crf. Additional Context)
Expected behavior It should successfully compile
Screenshots
System (please complete the following information):
- Windows 11
- Ulfius 2.7.13
- git clone
Additional context Here is my CMakeLists.txt
cmake_minimum_required(VERSION 3.22.1)
project(myapp C)
if (WIN32)
set(MHD_LIBRARY ${PROJECT_SOURCE_DIR}/libs/microhttpd-w32/lib/libmicrohttpd.a)
set(MHD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/libs/microhttpd-w32/include)
endif ()
add_subdirectory(libs/ulfius-2.7.13)
include_directories(include)
set(SOURCES)
add_executable(${PROJECT_NAME} main.c ${SOURCES})
target_link_libraries(${PROJECT_NAME}
ulfius_static)
if (NOT WIN32)
target_link_libraries(${PROJECT_NAME} m)
endif ()
Hello,
Unfortunately, I don't know much on windows build or mingw64, I believe it's possible since I think other were able to build it, but I wouldn't know how.
Alo.
Sorry, we do not understand this issue.
I've been looking into this as well and still haven't found a smooth solution to building ulfius on windows
However, maybe trying zig cc command to build on windows.
link your libs and stuff and disable websockets to build easier for windows
With some tweaking of this command, I think we might be able to get some results on windows
zig cc -I /path/to/libmicrohttpd/bin -I /path/to/orcania -I /path/to/yder -o ulfius.o ulfius.c
I've never used zig in my life. However, if it works fine on different platforms and/or OSes (e.g. Mac, Linux & Windows), we should give it a try. More than happy to assist.