From b5a4a5537063327f0a327d920bd48515cef44ce5 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 7 Sep 2011 19:58:26 +0100 Subject: [PATCH 1/3] Cmake Windows tweaks. --- CMakeLists.txt | 2 +- simgear/threads/CMakeLists.txt | 9 ++------- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 055f915c..de222a92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -157,7 +157,7 @@ if(WIN32) # SET(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}") # endforeach(warning) - set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS") + set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS /wd4996") endif(MSVC) # assumed on Windows diff --git a/simgear/threads/CMakeLists.txt b/simgear/threads/CMakeLists.txt index 9eb4d540..5258be8f 100644 --- a/simgear/threads/CMakeLists.txt +++ b/simgear/threads/CMakeLists.txt @@ -5,10 +5,5 @@ set(HEADERS SGQueue.hxx SGThread.hxx) - -if (MSVC) - install (FILES ${HEADERS} DESTINATION include/simgear/threads) -else (MSVC) - set(SOURCES SGThread.cxx) - simgear_component(threads threads "${SOURCES}" "${HEADERS}") -endif(MSVC) +set(SOURCES SGThread.cxx) +simgear_component(threads threads "${SOURCES}" "${HEADERS}") From 3a210d6fa69a9bdaf29715f1cef720930183ce65 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 7 Sep 2011 20:12:35 +0100 Subject: [PATCH 2/3] Make sgio tests friendly to Windows. --- CMakeLists.txt | 2 ++ simgear/io/CMakeLists.txt | 3 +++ simgear/io/httpget.cxx | 6 +++--- 3 files changed, 8 insertions(+), 3 deletions(-) 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()) { From b0015ab6e83348cbe26eec1d81400ff2da52a4a4 Mon Sep 17 00:00:00 2001 From: James Turner Date: Wed, 7 Sep 2011 20:41:55 +0100 Subject: [PATCH 3/3] Further Windows Cmake tweaks. --- CMakeLists.txt | 1 + simgear/io/httpget.cxx | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index b79026c7..a82b0081 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -164,6 +164,7 @@ if(WIN32) set(HAVE_GETLOCALTIME 1) set( WINSOCK_LIBRARY "ws2_32.lib" ) + set( RT_LIBRARY "winmm" ) endif(WIN32) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS}") diff --git a/simgear/io/httpget.cxx b/simgear/io/httpget.cxx index b65a9274..e10a29b4 100644 --- a/simgear/io/httpget.cxx +++ b/simgear/io/httpget.cxx @@ -133,7 +133,9 @@ int main(int argc, char* argv[]) cl.setProxy(proxyHost, proxyPort, proxyAuth); } +#ifndef WIN32 signal(SIGPIPE, SIG_IGN); +#endif if (!outFile) { outFile = new SGFile(fileno(stdout));