mirror of
https://github.com/TerryCavanagh/VVVVVV.git
synced 2026-01-29 09:28:15 +03: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:
@@ -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})
|
||||
|
||||
|
||||
Reference in New Issue
Block a user