Skip to content

Commit

Permalink
Fixes for windows compilation
Browse files Browse the repository at this point in the history
  • Loading branch information
sbellus committed Aug 17, 2017
1 parent 3280b7e commit bab8051
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 11 deletions.
31 changes: 21 additions & 10 deletions libmicrohttpd/src/microhttpd/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,18 @@ install(DIRECTORY ${PROJECT_SOURCE_DIR}/src/include/ DESTINATION include/microht

ProcessorCount(CPU_COUNT)

add_executable(test_str_compare test_str.c mhd_str.c)
add_test(NAME str_compare COMMAND test_str_compare)
if (MSVC)
set(SOCKET_LIBS Ws2_32)
endif()

if (NOT MSVC)
# it is not possible to compile test_str.c witn MSVC
add_executable(test_str_compare test_str.c mhd_str.c)
add_test(NAME str_compare COMMAND test_str_compare)

add_executable(test_str_to_value test_str.c mhd_str.c)
add_test(NAME str_to_value COMMAND test_str_to_value)
add_executable(test_str_to_value test_str.c mhd_str.c)
add_test(NAME str_to_value COMMAND test_str_to_value)
endif()

add_executable(test_str_token test_str_token.c mhd_str.c)
add_test(NAME str_token COMMAND test_str_token)
Expand All @@ -103,15 +110,15 @@ set(THREADS_HAVE_PTHREAD_ARG yes)
include(FindThreads)

add_executable(test_shutdown_select test_shutdown_select.c)
target_link_libraries(test_shutdown_select Threads::Threads)
target_link_libraries(test_shutdown_select Threads::Threads ${SOCKET_LIBS})
target_compile_options(test_shutdown_select PRIVATE -DCPU_COUNT=${CPU_COUNT})
add_test(NAME shutdown_select COMMAND test_shutdown_select)
if (NOT HAVE_LISTEN_SHUTDOWN)
set_tests_properties(shutdown_select PROPERTIES WILL_FAIL yes)
endif()

add_executable(test_shutdown_poll test_shutdown_select.c mhd_threads.h)
target_link_libraries(test_shutdown_poll Threads::Threads)
target_link_libraries(test_shutdown_poll Threads::Threads ${SOCKET_LIBS})
target_compile_options(test_shutdown_poll PRIVATE -DCPU_COUNT=${CPU_COUNT})
add_test(NAME shutdown_poll COMMAND test_shutdown_poll)
if (NOT HAVE_LISTEN_SHUTDOWN)
Expand Down Expand Up @@ -140,10 +147,14 @@ if (CMAKE_USE_PTHREADS_INIT)
endif()

if (HAVE_POSTPROCESSOR)
add_executable(test_postprocessor test_postprocessor.c)
target_link_libraries(test_postprocessor microhttpd)
target_compile_options(test_postprocessor PRIVATE -DCPU_COUNT=${CPU_COUNT} ${GNUTLS_DEFINITIONS})
add_test(NAME postprocessor COMMAND test_postprocessor)
if (NOT MSVC)
# it is not possible to compile test_postprocessor.c witn MSVC

add_executable(test_postprocessor test_postprocessor.c)
target_link_libraries(test_postprocessor microhttpd)
target_compile_options(test_postprocessor PRIVATE -DCPU_COUNT=${CPU_COUNT} ${GNUTLS_DEFINITIONS})
add_test(NAME postprocessor COMMAND test_postprocessor)
endif()

add_executable(test_postprocessor_large test_postprocessor_large.c)
target_link_libraries(test_postprocessor_large microhttpd)
Expand Down
2 changes: 1 addition & 1 deletion libmicrohttpd/src/testcurl/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ endif()

ProcessorCount(CPU_COUNT)
add_definitions(-DCPU_COUNT=${CPU_COUNT} ${LIBCURL_CPPFLAGS})
include_directories(${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/microhttpd ${PROJECT_SOURCE_DIR}/src/include)
include_directories(${CURL_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR}/src/microhttpd ${PROJECT_SOURCE_DIR}/src/include)

add_executable(test_start_stop test_start_stop.c)
target_link_libraries(test_start_stop microhttpd)
Expand Down

0 comments on commit bab8051

Please sign in to comment.