[CMake] Automatically expose WTF_USE_FOO to the build when USE_FOO is exposed
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Apr 2015 16:17:08 +0000 (16:17 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 30 Apr 2015 16:17:08 +0000 (16:17 +0000)
https://bugs.webkit.org/show_bug.cgi?id=144394

Reviewed by Carlos Garcia Campos.

Automatically expose WTF_USE_FOO when USE_FOO is exposed. A side-effect of this change
is that it fixes the redirected XComposite window for GTK+, which was accidentally
disabled in previous reworking of the CMake configuration.

* Source/cmake/OptionsGTK.cmake: We no longer need to expose the WTF_ prefixed
version of USE variables.
* Source/cmake/WebKitFeatures.cmake: Automatically expose WTF_USE_FOO when USE_FOO
is exposed to the build.

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

ChangeLog
Source/cmake/OptionsGTK.cmake
Source/cmake/WebKitFeatures.cmake

index 9052242..babdb7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,19 @@
+2015-04-30  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] Automatically expose WTF_USE_FOO to the build when USE_FOO is exposed
+        https://bugs.webkit.org/show_bug.cgi?id=144394
+
+        Reviewed by Carlos Garcia Campos.
+
+        Automatically expose WTF_USE_FOO when USE_FOO is exposed. A side-effect of this change
+        is that it fixes the redirected XComposite window for GTK+, which was accidentally
+        disabled in previous reworking of the CMake configuration.
+
+        * Source/cmake/OptionsGTK.cmake: We no longer need to expose the WTF_ prefixed
+        version of USE variables.
+        * Source/cmake/WebKitFeatures.cmake: Automatically expose WTF_USE_FOO when USE_FOO
+        is exposed to the build.
+
 2015-04-30  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         Unreviewed. Bump GTK+ version numbers.
index 00546ae..c19b961 100644 (file)
@@ -352,14 +352,12 @@ if (ENABLE_VIDEO OR ENABLE_WEB_AUDIO)
         if (NOT PC_GSTREAMER_MPEGTS_FOUND)
             message(FATAL_ERROR "GStreamer MPEG-TS is needed for USE_GSTREAMER_MPEGTS.")
         endif ()
-        SET_AND_EXPOSE_TO_BUILD(WTF_USE_GSTREAMER_MPEGTS TRUE)
     endif ()
 
     if (USE_GSTREAMER_GL)
         if (NOT PC_GSTREAMER_GL_FOUND)
             message(FATAL_ERROR "GStreamerGL is needed for USE_GSTREAMER_GL.")
         endif ()
-        SET_AND_EXPOSE_TO_BUILD(WTF_USE_GSTREAMER_GL TRUE)
     endif ()
 endif ()
 
@@ -376,7 +374,6 @@ if (USE_LIBNOTIFY)
     if (NOT LIBNOTIFY_FOUND)
        message(FATAL_ERROR "libnotify is needed for USE_LIBNOTIFY.")
     endif ()
-    SET_AND_EXPOSE_TO_BUILD(WTF_USE_LIBNOTIFY TRUE)
 endif ()
 
 if (USE_LIBHYPHEN)
@@ -384,7 +381,6 @@ if (USE_LIBHYPHEN)
     if (NOT HYPHEN_FOUND)
        message(FATAL_ERROR "libhyphen is needed for USE_LIBHYPHEN.")
     endif ()
-    SET_AND_EXPOSE_TO_BUILD(WTF_USE_LIBHYPHEN 1)
 endif ()
 
 set(DERIVED_SOURCES_GOBJECT_DOM_BINDINGS_DIR ${DERIVED_SOURCES_DIR}/webkitdom)
index 76bdb57..e959fbf 100644 (file)
@@ -290,15 +290,28 @@ macro(SET_AND_EXPOSE_TO_BUILD _variable_name)
     EXPOSE_VARIABLE_TO_BUILD(${_variable_name})
 endmacro()
 
+macro(_ADD_CONFIGURATION_LINE_TO_HEADER_STRING _string _variable_name _output_variable_name)
+    if (${${_variable_name}})
+        set(${_string} "${_file_contents}#define ${_output_variable_name} 1\n")
+    else ()
+        set(${_string} "${_file_contents}#define ${_output_variable_name} 0\n")
+    endif ()
+endmacro()
+
 macro(CREATE_CONFIGURATION_HEADER)
     list(SORT _WEBKIT_CONFIG_FILE_VARIABLES)
     set(_file_contents "#ifndef CMAKECONFIG_H\n")
     set(_file_contents "${_file_contents}#define CMAKECONFIG_H\n\n")
+
     foreach (_variable_name ${_WEBKIT_CONFIG_FILE_VARIABLES})
-        if (${${_variable_name}})
-            set(_file_contents "${_file_contents}#define ${_variable_name} 1\n")
-        else ()
-            set(_file_contents "${_file_contents}#define ${_variable_name} 0\n")
+        _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} ${_variable_name})
+
+        # WebKit looks for WTF_USE_FOO when calling the USE(FOO) macro. Automatically exposing
+        # this definition when USE_FOO is exposed, prevents us from having to expose both (or
+        # forgetting to do so).
+        string(FIND ${_variable_name} "USE_" _use_string_location)
+        if (${_use_string_location} EQUAL 0)
+            _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} "WTF_${_variable_name}")
         endif ()
     endforeach ()
     set(_file_contents "${_file_contents}\n#endif /* CMAKECONFIG_H */\n")