Make sgio tests friendly to Windows.

This commit is contained in:
James Turner 2011-09-07 20:12:35 +01:00
parent b5a4a55370
commit 3a210d6fa6
3 changed files with 8 additions and 3 deletions

View File

@ -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}")

View File

@ -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})

View File

@ -1,11 +1,11 @@
#include <cstdio>
#include <cstring>
#include <signal.h>
#include <unistd.h> // for STDOUT_FILENO
#include <iostream>
#include <boost/foreach.hpp>
#include <signal.h>
#include <simgear/io/sg_file.hxx>
#include <simgear/io/HTTPClient.hxx>
@ -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()) {