[CMake] Add support for building with various sanitizer tools
authorzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jun 2015 11:55:45 +0000 (11:55 +0000)
committerzandobersek@gmail.com <zandobersek@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 22 Jun 2015 11:55:45 +0000 (11:55 +0000)
https://bugs.webkit.org/show_bug.cgi?id=131941

Reviewed by Martin Robinson.

* Source/PlatformGTK.cmake: Don't generate any documentation
when compiling with sanitizers enabled.
* Source/cmake/OptionsCommon.cmake: Allow linking with
undefined symbols when compiling with sanitizers enabled.

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

ChangeLog
Source/PlatformGTK.cmake
Source/cmake/OptionsCommon.cmake

index da66c03..de0680e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+2015-06-22  Zan Dobersek  <zdobersek@igalia.com>
+
+        [CMake] Add support for building with various sanitizer tools
+        https://bugs.webkit.org/show_bug.cgi?id=131941
+
+        Reviewed by Martin Robinson.
+
+        * Source/PlatformGTK.cmake: Don't generate any documentation
+        when compiling with sanitizers enabled.
+        * Source/cmake/OptionsCommon.cmake: Allow linking with
+        undefined symbols when compiling with sanitizers enabled.
+
 2015-06-21  Philip Chimento  <philip.chimento@gmail.com>
 
         libwebkit2gtk fails to link without opengl
index eeffa8b..42b1874 100644 (file)
@@ -34,7 +34,7 @@ endmacro()
 add_gtkdoc_generator("docs-build.stamp" "")
 if (ENABLE_GTKDOC)
     add_custom_target(gtkdoc ALL DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
-else ()
+elseif (NOT ENABLED_COMPILER_SANITIZERS)
     add_custom_target(gtkdoc DEPENDS "${CMAKE_BINARY_DIR}/docs-build.stamp")
 
     # Add a default build step which check that documentation does not have any warnings
index fc31253..6691526 100644 (file)
@@ -104,7 +104,9 @@ if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU" AND "${LOWERCASE_CMAKE_HOST_SYSTEM
     set(CMAKE_SHARED_LINKER_FLAGS_DEBUG "-Wl,--no-keep-memory ${CMAKE_SHARED_LINKER_FLAGS_DEBUG}")
 endif ()
 
-if (UNIX AND NOT APPLE)
+string(REGEX MATCHALL "-fsanitize=[^ ]*" ENABLED_COMPILER_SANITIZERS ${CMAKE_CXX_FLAGS})
+
+if (UNIX AND NOT APPLE AND NOT ENABLED_COMPILER_SANITIZERS)
     set(CMAKE_SHARED_LINKER_FLAGS "-Wl,--no-undefined ${CMAKE_SHARED_LINKER_FLAGS}")
 endif ()