]> git.mxchange.org Git - simgear.git/commitdiff
Make sgio tests friendly to Windows.
authorJames Turner <zakalawe@mac.com>
Wed, 7 Sep 2011 19:12:35 +0000 (20:12 +0100)
committerJames Turner <zakalawe@mac.com>
Wed, 7 Sep 2011 19:12:35 +0000 (20:12 +0100)
CMakeLists.txt
simgear/io/CMakeLists.txt
simgear/io/httpget.cxx

index de222a924e68ee279f4bb7d10480c94260c82edc..b79026c713f5ca084984beb6b0fb253b31456d7c 100644 (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}")
index 9613e4b98d8e9fa45b078e1123c54f61ba8fc22d..e85d9659c7e0f0d3865fb5d940b899e823a8e97a 100644 (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})
index a8e226066a7bbf2f67d6e8496a82ce9f3844c96b..b65a9274bca6dc090c3d3ae15e46b540e67e2b3d 100644 (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()) {