From b7c43b8c59678c388a42a90993f72f0bd3aebd64 Mon Sep 17 00:00:00 2001 From: Oscar Fuentes Date: Thu, 13 Jan 2011 15:31:45 +0000 Subject: [PATCH] Disable RTTI when building unit tests. This avoids errors at link time. llvm-svn: 123377 --- llvm/unittests/CMakeLists.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/llvm/unittests/CMakeLists.txt b/llvm/unittests/CMakeLists.txt index 61ea1ee55af4..5f09fa248357 100644 --- a/llvm/unittests/CMakeLists.txt +++ b/llvm/unittests/CMakeLists.txt @@ -18,6 +18,12 @@ add_custom_target(UnitTests) include_directories(${LLVM_MAIN_SRC_DIR}/utils/unittest/googletest/include) add_definitions(-DGTEST_HAS_RTTI=0) +if( CMAKE_COMPILER_IS_GNUCXX ) + llvm_replace_compiler_option(CMAKE_CXX_FLAGS "-frtti" "-fno-rtti") +elseif( MSVC ) + llvm_replace_compiler_option(CMAKE_CXX_FLAGS "/GR" "/GR-") +endif() + if (NOT LLVM_ENABLE_THREADS) add_definitions(-DGTEST_HAS_PTHREAD=0) endif()