Add an option to make Exceptions enabled (#2239)
* Add an option to make Exceptions enabled * /EHsc enable exceptions since vs2003
This commit is contained in:
parent
2e0f0a0517
commit
044113abe8
@ -57,6 +57,7 @@ CMAKE_DEPENDENT_OPTION(ENABLE_HLSL
|
|||||||
OFF)
|
OFF)
|
||||||
|
|
||||||
option(ENABLE_RTTI "Enables RTTI" OFF)
|
option(ENABLE_RTTI "Enables RTTI" OFF)
|
||||||
|
option(ENABLE_EXCEPTIONS "Enables Exceptions" OFF)
|
||||||
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
|
option(ENABLE_OPT "Enables spirv-opt capability if present" ON)
|
||||||
option(ENABLE_PCH "Enables Precompiled header" ON)
|
option(ENABLE_PCH "Enables Precompiled header" ON)
|
||||||
option(ENABLE_CTEST "Enables testing" ON)
|
option(ENABLE_CTEST "Enables testing" ON)
|
||||||
@ -121,6 +122,9 @@ if(${CMAKE_CXX_COMPILER_ID} MATCHES "GNU")
|
|||||||
if(NOT ENABLE_RTTI)
|
if(NOT ENABLE_RTTI)
|
||||||
add_compile_options(-fno-rtti)
|
add_compile_options(-fno-rtti)
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT ENABLE_EXCEPTIONS)
|
||||||
|
add_compile_options(-fno-exceptions)
|
||||||
|
endif()
|
||||||
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
|
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS "9.0.0")
|
||||||
add_compile_options(-Werror=deprecated-copy)
|
add_compile_options(-Werror=deprecated-copy)
|
||||||
endif()
|
endif()
|
||||||
@ -131,17 +135,23 @@ elseif(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
|
|||||||
if(NOT ENABLE_RTTI)
|
if(NOT ENABLE_RTTI)
|
||||||
add_compile_options(-fno-rtti)
|
add_compile_options(-fno-rtti)
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT ENABLE_EXCEPTIONS)
|
||||||
|
add_compile_options(-fno-exceptions)
|
||||||
|
endif()
|
||||||
elseif(MSVC)
|
elseif(MSVC)
|
||||||
if(NOT ENABLE_RTTI)
|
if(NOT ENABLE_RTTI)
|
||||||
add_compile_options(/GR-) # Disable RTTI
|
add_compile_options(/GR-) # Disable RTTI
|
||||||
endif()
|
endif()
|
||||||
|
if(ENABLE_EXCEPTIONS)
|
||||||
|
add_compile_options(/EHsc) # Enable Exceptions
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ENABLE_GLSLANG_JS)
|
if(ENABLE_GLSLANG_JS)
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
add_compile_options(/Os /GR-)
|
add_compile_options(/Os /GR-)
|
||||||
else()
|
else()
|
||||||
add_compile_options(-Os -fno-exceptions)
|
add_compile_options(-Os -fno-rtti -fno-exceptions)
|
||||||
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
|
if(${CMAKE_CXX_COMPILER_ID} MATCHES "Clang" AND NOT MSVC)
|
||||||
add_compile_options(-Wno-unused-parameter)
|
add_compile_options(-Wno-unused-parameter)
|
||||||
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
|
add_compile_options(-Wno-unused-variable -Wno-unused-const-variable)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user