Title: [294943] trunk/Source/cmake/WebKitFeatures.cmake
Revision
294943
Author
don.olmst...@sony.com
Date
2022-05-27 10:59:51 -0700 (Fri, 27 May 2022)

Log Message

[CMake] Support string values in cmakeconfig.h
https://bugs.webkit.org/show_bug.cgi?id=241013

Reviewed by Adrian Perez de Castro and Michael Catanzaro.

Add `EXPOSE_STRING_VARIABLE_TO_BUILD` which adds a string variable to the config. Modify
`CREATE_CONFIGURATION_HEADER` to output the values to `cmakeconfig.h`.

* Source/cmake/WebKitFeatures.cmake:

Canonical link: https://commits.webkit.org/251053@main

Modified Paths

Diff

Modified: trunk/Source/cmake/WebKitFeatures.cmake (294942 => 294943)


--- trunk/Source/cmake/WebKitFeatures.cmake	2022-05-27 17:58:08 UTC (rev 294942)
+++ trunk/Source/cmake/WebKitFeatures.cmake	2022-05-27 17:59:51 UTC (rev 294943)
@@ -360,11 +360,16 @@
 endmacro()
 
 set(_WEBKIT_CONFIG_FILE_VARIABLES "")
+set(_WEBKIT_CONFIG_FILE_STRING_VARIABLES "")
 
 macro(EXPOSE_VARIABLE_TO_BUILD _variable_name)
     list(APPEND _WEBKIT_CONFIG_FILE_VARIABLES ${_variable_name})
 endmacro()
 
+macro(EXPOSE_STRING_VARIABLE_TO_BUILD _variable_name)
+    list(APPEND _WEBKIT_CONFIG_FILE_STRING_VARIABLES ${_variable_name})
+endmacro()
+
 macro(SET_AND_EXPOSE_TO_BUILD _variable_name)
     # It's important to handle the case where the value isn't passed, because often
     # during configuration an empty variable is the result of a failed package search.
@@ -394,6 +399,9 @@
     foreach (_variable_name ${_WEBKIT_CONFIG_FILE_VARIABLES})
         _ADD_CONFIGURATION_LINE_TO_HEADER_STRING(_file_contents ${_variable_name} ${_variable_name})
     endforeach ()
+    foreach (_variable_name ${_WEBKIT_CONFIG_FILE_STRING_VARIABLES})
+        set(_file_contents "${_file_contents}#define ${_variable_name} \"${${_variable_name}}\"\n")
+    endforeach ()
     set(_file_contents "${_file_contents}\n#endif /* CMAKECONFIG_H */\n")
 
     file(WRITE "${CMAKE_BINARY_DIR}/cmakeconfig.h.tmp" "${_file_contents}")
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to