summaryrefslogtreecommitdiffstats
path: root/googletest/cmake
diff options
context:
space:
mode:
authorEnji Cooper <yaneurabeya@gmail.com>2019-02-21 19:41:38 (GMT)
committerEnji Cooper <yaneurabeya@gmail.com>2019-04-04 04:09:20 (GMT)
commit7475ba5039753da07b5c80ccd61983dc83c82cb0 (patch)
treed232ab15b989251b75a9daa60934d569c65dc06f /googletest/cmake
parent1f3b098ef3afb1d186778d47ccecf9d188ef49b2 (diff)
downloadgoogletest-7475ba5039753da07b5c80ccd61983dc83c82cb0.zip
googletest-7475ba5039753da07b5c80ccd61983dc83c82cb0.tar.gz
googletest-7475ba5039753da07b5c80ccd61983dc83c82cb0.tar.bz2
clang: explicitly enable/disable RTTI support with the compiler
Add `-frtti` to the compiler with the base flags case so that RTTI is enabled by default with clang. Add its inverse analog, `cxx_no_rtti_flags` in order to test the case with RTTI off, similar to gcc. This reduces the amount of testing/support overhead needed in the non-RTTI case with clang, as the tests currently fail when these two features are off with version 1.8.1. This something I used in when investigating test failures on FreeBSD, as the tests that rely on RTTI were failing with googletest 1.8.1 on the OS platform. More investigation is being done to determine how this should be fixed on FreeBSD 11.2-RELEASE with ports, as the package doesn't currently compile the tests, and when enabled (based on my WIP diff), the tests fail in similar ways. Signed-off-by: Enji Cooper <yaneurabeya@gmail.com>
Diffstat (limited to 'googletest/cmake')
-rw-r--r--googletest/cmake/internal_utils.cmake3
1 files changed, 2 insertions, 1 deletions
diff --git a/googletest/cmake/internal_utils.cmake b/googletest/cmake/internal_utils.cmake
index eab18fd..beaefe6 100644
--- a/googletest/cmake/internal_utils.cmake
+++ b/googletest/cmake/internal_utils.cmake
@@ -78,10 +78,11 @@ macro(config_compiler_and_linker)
# http://stackoverflow.com/questions/3232669 explains the issue.
set(cxx_base_flags "${cxx_base_flags} -wd4702")
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
- set(cxx_base_flags "-Wall -Wshadow -Werror -Wno-error=sign-conversion")
+ set(cxx_base_flags "-Wall -Wshadow -Werror -Wno-error=sign-conversion -frtti")
set(cxx_exception_flags "-fexceptions")
set(cxx_no_exception_flags "-fno-exceptions")
set(cxx_strict_flags "-W -Wpointer-arith -Wreturn-type -Wcast-qual -Wwrite-strings -Wswitch -Wunused-parameter -Wcast-align -Wchar-subscripts -Winline -Wredundant-decls")
+ set(cxx_no_rtti_flags "-fno-rtti")
elseif (CMAKE_COMPILER_IS_GNUCXX)
set(cxx_base_flags "-Wall -Wshadow -Werror")
if(NOT CMAKE_CXX_COMPILER_VERSION VERSION_LESS 7.0.0)