added definition _WINDOWS for (mingw and others) compatibility
This commit is contained in:
parent
18adaef056
commit
5ee50170b0
4 changed files with 23 additions and 13 deletions
|
|
@ -53,6 +53,10 @@ INCLUDE(ConfigureChecks.cmake)
|
||||||
# now create config headers
|
# now create config headers
|
||||||
configure_file(config.h.cmake ${CMAKE_CURRENT_BINARY_DIR}/config.h )
|
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)
|
# 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(WIN32 AND NOT CYGWIN)
|
||||||
IF(NOT CMAKE_BUILD_TYPE)
|
IF(NOT CMAKE_BUILD_TYPE)
|
||||||
|
|
@ -101,4 +105,3 @@ ENDIF (ENABLE_CMAKE_TESTING)
|
||||||
|
|
||||||
######################################################################################
|
######################################################################################
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -42,11 +42,13 @@ void signal_handler( int sig )
|
||||||
// ---------------------------
|
// ---------------------------
|
||||||
{
|
{
|
||||||
// --- On veut la paix, jusqu'a la fin ---
|
// --- On veut la paix, jusqu'a la fin ---
|
||||||
|
#ifndef _WINDOWS
|
||||||
#ifdef SIGQUIT
|
#ifdef SIGQUIT
|
||||||
signal( SIGINT, SIG_IGN );
|
signal( SIGINT, SIG_IGN );
|
||||||
signal( SIGQUIT, SIG_IGN );
|
signal( SIGQUIT, SIG_IGN );
|
||||||
std::cerr << "Ctrl C entered ... closing down" << std::endl ;
|
std::cerr << "Ctrl C entered ... closing down" << std::endl ;
|
||||||
arret_demande = true;
|
arret_demande = true;
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// the same thing can probably be done in MS environement, but I hoave no way
|
// 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
|
// to test it so at the moment it is commented out when in MSVC
|
||||||
#ifndef _MSC_VER
|
|
||||||
|
|
||||||
#ifndef eoCtrlCContinue_h
|
#ifndef eoCtrlCContinue_h
|
||||||
#define eoCtrlCContinue_h
|
#define eoCtrlCContinue_h
|
||||||
|
|
@ -52,9 +52,15 @@ public:
|
||||||
// First checks that no other eoCtrlCContinue does exist
|
// First checks that no other eoCtrlCContinue does exist
|
||||||
if (existCtrlCContinue)
|
if (existCtrlCContinue)
|
||||||
throw std::runtime_error("A signal handler for Ctrl C is already defined!\n");
|
throw std::runtime_error("A signal handler for Ctrl C is already defined!\n");
|
||||||
|
|
||||||
|
#ifndef _WINDOWS
|
||||||
|
#ifdef SIGQUIT
|
||||||
signal( SIGINT, signal_handler );
|
signal( SIGINT, signal_handler );
|
||||||
signal( SIGQUIT, signal_handler );
|
signal( SIGQUIT, signal_handler );
|
||||||
existCtrlCContinue = true;
|
existCtrlCContinue = true;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Returns false when Ctrl C has been typed in
|
/** Returns false when Ctrl C has been typed in
|
||||||
|
|
@ -72,5 +78,4 @@ public:
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
|
||||||
// of MSVC comment-out
|
// of MSVC comment-out
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef _MSC_VER
|
#ifndef _WINDOWS
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
|
||||||
Reference in a new issue