Add -frtti for tests that use mocking
authorDavid Neto <dneto@google.com>
Tue, 1 Dec 2015 15:01:33 +0000 (10:01 -0500)
committerDavid Neto <dneto@google.com>
Tue, 1 Dec 2015 15:01:33 +0000 (10:01 -0500)
The tests now use mocked methods.  This requires runtime type
information for those test classes.
https://github.com/google/googletest/issues/610

This has been fixed recently upstream in googletest.  Until we pick
up that fix, add -frtti for the the test executable only.

CMakeLists.txt

index 6826b98..65c4ef5 100644 (file)
@@ -219,6 +219,13 @@ if (NOT ${SPIRV_SKIP_EXECUTABLES})
 
     add_executable(UnitSPIRV ${TEST_SOURCES})
     default_compile_options(UnitSPIRV)
+    if (UNIX)
+      # The tests use mocking, and mocking requires runtime type information
+      # for the test classes.  Until we adopt a version of gmock that avoids
+      # this problem (see https://github.com/google/googletest/issues/610),
+      # add RTTI.
+      target_compile_options(UnitSPIRV PRIVATE -frtti)
+    endif()
     target_include_directories(UnitSPIRV PRIVATE
       ${gmock_SOURCE_DIR}/include ${gtest_SOURCE_DIR}/include)
     target_link_libraries(UnitSPIRV PRIVATE ${SPIRV_TOOLS} gmock)