From 5ee50170b0b7dd726cc9ab49ba20ad60777e0972 Mon Sep 17 00:00:00 2001 From: tlegrand Date: Mon, 26 Nov 2007 07:56:08 +0000 Subject: [PATCH] added definition _WINDOWS for (mingw and others) compatibility --- eo/CMakeLists.txt | 7 +++++-- eo/src/eoCtrlCContinue.cpp | 12 +++++++----- eo/src/eoCtrlCContinue.h | 15 ++++++++++----- eo/src/utils/pipecom.cpp | 2 +- 4 files changed, 23 insertions(+), 13 deletions(-) diff --git a/eo/CMakeLists.txt b/eo/CMakeLists.txt index 7fe0091c..5f5ddf68 100644 --- a/eo/CMakeLists.txt +++ b/eo/CMakeLists.txt @@ -53,6 +53,10 @@ INCLUDE(ConfigureChecks.cmake) # now create config headers configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) +# Set a special flag if the environment is windows +IF (WIN32) + ADD_DEFINITIONS(-D_WINDOWS=1) +ENDIF (WIN32) ###################################################################################### @@ -61,7 +65,7 @@ configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h ) ##################################################################################### # the user should choose the build type on windows environments,excepted under cygwin (default=none) -SET(CMAKE_DEFAULT_BUILD_TYPE None CACHE STRING "Variable that stores the default CMake build type" FORCE) +SET(CMAKE_DEFAULT_BUILD_TYPE "" CACHE STRING "Variable that stores the default CMake build type" FORCE) IF(WIN32 AND NOT CYGWIN) IF(NOT CMAKE_BUILD_TYPE) @@ -101,4 +105,3 @@ ENDIF (ENABLE_CMAKE_TESTING) ###################################################################################### - diff --git a/eo/src/eoCtrlCContinue.cpp b/eo/src/eoCtrlCContinue.cpp index 51166ef2..cf6146e6 100644 --- a/eo/src/eoCtrlCContinue.cpp +++ b/eo/src/eoCtrlCContinue.cpp @@ -42,11 +42,13 @@ void signal_handler( int sig ) // --------------------------- { // --- On veut la paix, jusqu'a la fin --- -#ifdef SIGQUIT - signal( SIGINT, SIG_IGN ); - signal( SIGQUIT, SIG_IGN ); - std::cerr << "Ctrl C entered ... closing down" << std::endl ; - arret_demande = true; +#ifndef _WINDOWS + #ifdef SIGQUIT + signal( SIGINT, SIG_IGN ); + signal( SIGQUIT, SIG_IGN ); + std::cerr << "Ctrl C entered ... closing down" << std::endl ; + arret_demande = true; + #endif #endif } diff --git a/eo/src/eoCtrlCContinue.h b/eo/src/eoCtrlCContinue.h index f524fc97..1936a5e5 100644 --- a/eo/src/eoCtrlCContinue.h +++ b/eo/src/eoCtrlCContinue.h @@ -25,7 +25,7 @@ //----------------------------------------------------------------------------- // the same thing can probably be done in MS environement, but I hoave no way // to test it so at the moment it is commented out when in MSVC -#ifndef _MSC_VER + #ifndef eoCtrlCContinue_h #define eoCtrlCContinue_h @@ -52,9 +52,15 @@ public: // First checks that no other eoCtrlCContinue does exist if (existCtrlCContinue) throw std::runtime_error("A signal handler for Ctrl C is already defined!\n"); - signal( SIGINT, signal_handler ); - signal( SIGQUIT, signal_handler ); - existCtrlCContinue = true; + + #ifndef _WINDOWS + #ifdef SIGQUIT + signal( SIGINT, signal_handler ); + signal( SIGQUIT, signal_handler ); + existCtrlCContinue = true; + #endif + #endif + } /** Returns false when Ctrl C has been typed in @@ -72,5 +78,4 @@ public: #endif -#endif // of MSVC comment-out diff --git a/eo/src/utils/pipecom.cpp b/eo/src/utils/pipecom.cpp index a0e4e082..d11989ec 100644 --- a/eo/src/utils/pipecom.cpp +++ b/eo/src/utils/pipecom.cpp @@ -14,7 +14,7 @@ #include #endif -#ifndef _MSC_VER +#ifndef _WINDOWS #include #include