From: James Turner Date: Wed, 7 Sep 2011 19:12:35 +0000 (+0100) Subject: Make sgio tests friendly to Windows. X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=3a210d6fa69a9bdaf29715f1cef720930183ce65;p=simgear.git Make sgio tests friendly to Windows. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index de222a92..b79026c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -162,6 +162,8 @@ if(WIN32) # assumed on Windows set(HAVE_GETLOCALTIME 1) + + set( WINSOCK_LIBRARY "ws2_32.lib" ) endif(WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS}") diff --git a/simgear/io/CMakeLists.txt b/simgear/io/CMakeLists.txt index 9613e4b9..e85d9659 100644 --- a/simgear/io/CMakeLists.txt +++ b/simgear/io/CMakeLists.txt @@ -39,12 +39,14 @@ simgear_component(io io "${SOURCES}" "${HEADERS}") add_executable(test_sock socktest.cxx) target_link_libraries(test_sock sgio sgstructure sgthreads sgdebug ${CMAKE_THREAD_LIBS_INIT} + ${WINSOCK_LIBRARY} ${RT_LIBRARY}) add_executable(test_http test_HTTP.cxx) target_link_libraries(test_http sgio sgstructure sgthreads sgtiming sgmisc sgdebug ${CMAKE_THREAD_LIBS_INIT} + ${WINSOCK_LIBRARY} ${RT_LIBRARY}) add_test(http ${EXECUTABLE_OUTPUT_PATH}/test_http) @@ -53,4 +55,5 @@ add_executable(httpget httpget.cxx) target_link_libraries(httpget sgio sgstructure sgthreads sgtiming sgmisc sgdebug ${CMAKE_THREAD_LIBS_INIT} + ${WINSOCK_LIBRARY} ${RT_LIBRARY}) diff --git a/simgear/io/httpget.cxx b/simgear/io/httpget.cxx index a8e22606..b65a9274 100644 --- a/simgear/io/httpget.cxx +++ b/simgear/io/httpget.cxx @@ -1,11 +1,11 @@ #include #include +#include -#include // for STDOUT_FILENO #include #include -#include + #include #include @@ -136,7 +136,7 @@ int main(int argc, char* argv[]) signal(SIGPIPE, SIG_IGN); if (!outFile) { - outFile = new SGFile(STDOUT_FILENO); + outFile = new SGFile(fileno(stdout)); } if (url.empty()) {