mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2024-12-23 01:59:43 +01:00
Disable exceptions and RTTI in CMakeLists
These are two C++ features that we don't need, don't use, and will never use in the future. Apparently the best way of doing this in CMake is to fiddle with the CXX_FLAGS using regex. Now this is one less flag I need to supply myself when I invoke CMake...
This commit is contained in:
parent
83f438d694
commit
390720dacc
1 changed files with 18 additions and 0 deletions
|
@ -250,6 +250,24 @@ if(MSVC)
|
|||
target_compile_options(VVVVVV PRIVATE /wd4244)
|
||||
endif()
|
||||
|
||||
if(MSVC)
|
||||
# Disable exceptions
|
||||
string(REGEX REPLACE "/EH[a-z]+" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc")
|
||||
|
||||
# Disable RTTI
|
||||
string(REGEX REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /GR-")
|
||||
else()
|
||||
# Disable exceptions
|
||||
string(REGEX REPLACE "-fexceptions" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions")
|
||||
|
||||
# Disable RTTI
|
||||
string(REGEX REPLACE "-frtti" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti")
|
||||
endif()
|
||||
|
||||
# Unfortunately, it doesn't seem like distros package LodePNG
|
||||
add_library(lodepng-static STATIC ${PNG_SRC})
|
||||
|
||||
|
|
Loading…
Reference in a new issue