1
0
mirror of https://git.dev.opencascade.org/repos/occt.git synced 2025-05-16 10:54:53 +03:00

0027196: CMake - avoid setting option -EHa for compilers other than MSVC

Option -EHa is now added only if MSVC is defined.

Descriptions of option -fp:precise in CMake and method OSD::SetSignal() in header file are updated.
This commit is contained in:
abv 2016-02-22 11:03:27 +03:00 committed by bugmaster
parent 114b7bf18f
commit cb72870231
2 changed files with 16 additions and 7 deletions

View File

@ -5,6 +5,12 @@ if(FLAGS_ALREADY_INCLUDED)
endif() endif()
set(FLAGS_ALREADY_INCLUDED 1) set(FLAGS_ALREADY_INCLUDED 1)
# force option -fp:precise for Visual Studio projects.
#
# Note that while this option is default for MSVC compiler, Visual Studio
# project can be switched later to use Intel Compiler (ICC).
# Enforcing -fp:precise ensures that in such case ICC will use correct
# option instead of its default -fp:fast which is harmful for OCCT.
if (MSVC) if (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp:precise") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fp:precise")
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp:precise") set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fp:precise")
@ -31,7 +37,7 @@ endif()
string (REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}") string (REGEX MATCH "EHsc" ISFLAG "${CMAKE_CXX_FLAGS}")
if (ISFLAG) if (ISFLAG)
string (REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") string (REGEX REPLACE "EHsc" "EHa" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
elseif (WIN32) elseif (MSVC)
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa") set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -EHa")
endif() endif()

View File

@ -53,10 +53,10 @@ public:
DEFINE_STANDARD_ALLOC DEFINE_STANDARD_ALLOC
//! A tool to manage threads
//!
//! Sets signal and exception handlers. //! Sets signal and exception handlers.
//! <b>Windows-specific notes<\b> //!
//! ### Windows-specific notes
//!
//! Compiled with MS VC++ sets 3 main handlers: //! Compiled with MS VC++ sets 3 main handlers:
//! @li Signal handlers (via ::signal() functions) that translate system signals //! @li Signal handlers (via ::signal() functions) that translate system signals
//! (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting //! (SIGSEGV, SIGFPE, SIGILL) into C++ exceptions (classes inheriting
@ -75,12 +75,13 @@ public:
//! //!
//! If @a theFloatingSignal is TRUE then floating point exceptions will be //! If @a theFloatingSignal is TRUE then floating point exceptions will be
//! generated in accordance with the mask //! generated in accordance with the mask
//! <tt>_EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW<\tt> that is //! <tt>_EM_INVALID | _EM_DENORMAL | _EM_ZERODIVIDE | _EM_OVERFLOW</tt> that is
//! used to call ::_controlfp() system function. If @a theFloatingSignal is FALSE //! used to call ::_controlfp() system function. If @a theFloatingSignal is FALSE
//! corresponding operations (e.g. division by zero) will gracefully complete //! corresponding operations (e.g. division by zero) will gracefully complete
//! without an exception. //! without an exception.
//! //!
//! <b>Unix-specific notes<\b> //! ### Unix-specific notes
//!
//! OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals //! OSD::SetSignal() sets handlers (via ::sigaction()) for multiple signals
//! (SIGFPE, SIGSEGV, etc). Currently the number of handled signals is much //! (SIGFPE, SIGSEGV, etc). Currently the number of handled signals is much
//! greater than for Windows, in the future this may change to provide better //! greater than for Windows, in the future this may change to provide better
@ -92,7 +93,8 @@ public:
//! When compiled with OBJS macro defined, already set signal handlers (e.g. //! When compiled with OBJS macro defined, already set signal handlers (e.g.
//! by Data Base Managers) are not redefined. //! by Data Base Managers) are not redefined.
//! //!
//! <b>Common notes<\b> //! ### Common notes
//!
//! If OSD::SetSignal() method is used in at least one thread, it must also be //! If OSD::SetSignal() method is used in at least one thread, it must also be
//! called in any other thread where Open CASCADE will be used, to ensure //! called in any other thread where Open CASCADE will be used, to ensure
//! consistency of behavior. Its @a aFloatingSignal argument must be consistent //! consistency of behavior. Its @a aFloatingSignal argument must be consistent
@ -102,6 +104,7 @@ public:
//! ::throw() will be called) is regulated by the NO_CXX_EXCEPTIONS and //! ::throw() will be called) is regulated by the NO_CXX_EXCEPTIONS and
//! OCC_CONVERT_SIGNALS macros used during compilation of Open CASCADE and //! OCC_CONVERT_SIGNALS macros used during compilation of Open CASCADE and
//! user's code. Refer to Foundation Classes User's Guide for further details. //! user's code. Refer to Foundation Classes User's Guide for further details.
//!
Standard_EXPORT static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True); Standard_EXPORT static void SetSignal (const Standard_Boolean theFloatingSignal = Standard_True);
//! Commands the process to sleep for a number of seconds. //! Commands the process to sleep for a number of seconds.