[GTK][CMake] Build with -fno-rtti
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Mar 2014 20:13:24 +0000 (20:13 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 16 Mar 2014 20:13:24 +0000 (20:13 +0000)
https://bugs.webkit.org/show_bug.cgi?id=130261

Reviewed by Martin Robinson.

.:

* Source/cmake/OptionsCommon.cmake: List the -fno-exceptions, -fno-strict-aliasing
and -fno-rtti options in the global CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (-fno-rtti
is only listed in the latter). Replace -std=gnu++0x with the official -std=c++11 option.
* Source/cmake/WebKitHelpers.cmake: Stop -fno-exceptions and -fno-strict-aliasing
from being set through the WEBKIT_SET_EXTRA_COMPILER_FLAGS macro, they are now listed
in CMAKE_C_FLAGS and CMAKE_CXX_FLAGS.
* Source/cmake/gtest/CMakeLists.txt: Build GTest code with GTEST_HAS_RTTI macro defined to 0.

Tools:

* TestWebKitAPI/CMakeLists.txt: Build TestWebKitAPI with GTEST_HAS_RTTI macro
defined to 0 to prevent typeid use in included GTest headers.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@165709 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
Source/cmake/OptionsCommon.cmake
Source/cmake/WebKitHelpers.cmake
Source/cmake/gtest/CMakeLists.txt
Tools/ChangeLog
Tools/TestWebKitAPI/CMakeLists.txt

index bc6f210..314aecd 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,18 @@
+2014-03-16  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK][CMake] Build with -fno-rtti
+        https://bugs.webkit.org/show_bug.cgi?id=130261
+
+        Reviewed by Martin Robinson.
+
+        * Source/cmake/OptionsCommon.cmake: List the -fno-exceptions, -fno-strict-aliasing
+        and -fno-rtti options in the global CMAKE_C_FLAGS and CMAKE_CXX_FLAGS (-fno-rtti
+        is only listed in the latter). Replace -std=gnu++0x with the official -std=c++11 option.
+        * Source/cmake/WebKitHelpers.cmake: Stop -fno-exceptions and -fno-strict-aliasing
+        from being set through the WEBKIT_SET_EXTRA_COMPILER_FLAGS macro, they are now listed
+        in CMAKE_C_FLAGS and CMAKE_CXX_FLAGS.
+        * Source/cmake/gtest/CMakeLists.txt: Build GTest code with GTEST_HAS_RTTI macro defined to 0.
+
 2014-03-16  Brendan Long  <b.long@cablelabs.com>
 
         [GStreamer] CMake doesn't find the include path for gstreamer-base
index 582492c..d25e90c 100644 (file)
@@ -29,7 +29,9 @@ endif ()
 set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 
 if (CMAKE_COMPILER_IS_GNUCXX OR "${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
-    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=gnu++0x")
+    set(CMAKE_C_FLAGS "${CMAKE_CXX_FLAGS} -fno-exceptions -fno-strict-aliasing")
+    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fno-exceptions -fno-strict-aliasing -fno-rtti")
+
 endif ()
 
 string(TOLOWER ${CMAKE_HOST_SYSTEM_PROCESSOR} LOWERCASE_CMAKE_HOST_SYSTEM_PROCESSOR)
index 644ae18..ac186e8 100644 (file)
@@ -29,8 +29,6 @@ macro(WEBKIT_SET_EXTRA_COMPILER_FLAGS _target)
             set(OLD_COMPILE_FLAGS "-fPIC ${OLD_COMPILE_FLAGS}")
         endif ()
 
-        set(OLD_COMPILE_FLAGS "-fno-exceptions -fno-strict-aliasing ${OLD_COMPILE_FLAGS}")
-
         # Enable warnings by default
         if (NOT ${OPTION_IGNORECXX_WARNINGS})
             set(OLD_COMPILE_FLAGS "-Wall -Wextra -Wcast-align -Wformat-security -Wmissing-format-attribute -Wpointer-arith -Wundef -Wwrite-strings ${OLD_COMPILE_FLAGS}")
index 7f521a8..804ef3c 100644 (file)
@@ -22,7 +22,7 @@ add_library(gtest SHARED
     ${GTEST_DIR}/src/gtest-typed-test.cc
 )
 
-add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1)
+add_definitions(-DGTEST_CREATE_SHARED_LIBRARY=1 -DGTEST_HAS_RTTI=0)
 
 target_link_libraries(gtest
     WTF
index ecb09fd..aad2256 100644 (file)
@@ -1,3 +1,13 @@
+2014-03-16  Zan Dobersek  <zdobersek@igalia.com>
+
+        [GTK][CMake] Build with -fno-rtti
+        https://bugs.webkit.org/show_bug.cgi?id=130261
+
+        Reviewed by Martin Robinson.
+
+        * TestWebKitAPI/CMakeLists.txt: Build TestWebKitAPI with GTEST_HAS_RTTI macro
+        defined to 0 to prevent typeid use in included GTest headers.
+
 2014-03-16  Brian Burg  <bburg@apple.com>
 
         Web Inspector: vended backend commands file should be generated as part of the build
index 9ed4884..55d4716 100644 (file)
@@ -86,7 +86,7 @@ add_dependencies(TestWebKitAPIInjectedBundle ${ForwardingHeadersForTestWebKitAPI
 
 get_property(TestWebKitAPIInjectedBundle_PATH TARGET TestWebKitAPIInjectedBundle PROPERTY LOCATION)
 
-add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1
+add_definitions(-DGTEST_LINKED_AS_SHARED_LIBRARY=1 -DGTEST_HAS_RTTI=0
     -DTEST_WEBKIT2_RESOURCES_DIR=\"${TESTWEBKITAPI_DIR}/Tests/WebKit2\"
     -DTEST_INJECTED_BUNDLE_PATH=\"${TestWebKitAPIInjectedBundle_PATH}\"
 )