Skip to content

Commit

Permalink
Use parameter to enable RTTI for Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Jaques committed May 23, 2019
1 parent 71ab924 commit 8bbdd9a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/CompilerFlags.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -159,8 +159,10 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
# Remove /EHsc since /EHsc- will be added (otherwise we get a warning about replacing /EHsc with /EHsc-)
string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})

# Remove /GR since /GR- will be added (otherwise we get a warning about replacing /GR with /GR-)
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
if (NOT ${ALLOW_RTTI})
# Remove /GR since /GR- will be added (otherwise we get a warning about replacing /GR with /GR-)
string(REPLACE "/GR" "" CMAKE_CXX_FLAGS ${CMAKE_CXX_FLAGS})
endif()

set(COMPILER_FLAGS
"/W4"
Expand All @@ -185,8 +187,11 @@ elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
"/wd4718" # Workaround for https://bugreports.qt.io/browse/QTBUG-54089
"/nologo"
"/EHsc-" # disable exceptions
"/GR-" # disable RTTI
)

if (NOT ${ALLOW_RTTI})
list(APPEND COMPILER_FLAGS "/GR-") # disable RTTI
endif()
endif()

# Allow workarounds for specific frameworks
Expand Down

0 comments on commit 8bbdd9a

Please sign in to comment.