From 8bbdd9abcf7bb6ce96e86e0bbaeb882223a9772c Mon Sep 17 00:00:00 2001 From: Sam Jaques Date: Thu, 23 May 2019 10:34:53 +0200 Subject: [PATCH] Use parameter to enable RTTI for Windows --- src/CompilerFlags.cmake | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/CompilerFlags.cmake b/src/CompilerFlags.cmake index 1e82f32..add19b6 100644 --- a/src/CompilerFlags.cmake +++ b/src/CompilerFlags.cmake @@ -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" @@ -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