[CMake] The forwarding headers generated by WebKitMacros.m4 are incompatible with...
authormrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 17:03:10 +0000 (17:03 +0000)
committermrobinson@webkit.org <mrobinson@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 3 Jan 2014 17:03:10 +0000 (17:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126361

Reviewed by Philippe Normand.

Make the forwarding headers generated by WebKitMacros.m4 compatible with the headers
generated by the WebKit2 forwarding headers generation script.

* Source/cmake/WebKitMacros.cmake: Try to convert absolute paths in the forwarding headers
to ones that are relative to the Source directory.

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

ChangeLog
Source/cmake/WebKitMacros.cmake

index 86e11b6..3dc0b9b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,16 @@
+2014-01-03  Martin Robinson  <mrobinson@igalia.com>
+
+        [CMake] The forwarding headers generated by WebKitMacros.m4 are incompatible with the headers generated by generate-forwarding-headers.pl
+        https://bugs.webkit.org/show_bug.cgi?id=126361
+
+        Reviewed by Philippe Normand.
+
+        Make the forwarding headers generated by WebKitMacros.m4 compatible with the headers
+        generated by the WebKit2 forwarding headers generation script.
+
+        * Source/cmake/WebKitMacros.cmake: Try to convert absolute paths in the forwarding headers
+        to ones that are relative to the Source directory.
+
 2014-01-02  Carlos Garcia Campos  <cgarcia@igalia.com>
 
         REGRESSION(r160304): [GTK] Disable libtool fast install
index fd6aa99..ef37921 100644 (file)
@@ -203,17 +203,24 @@ endmacro()
 
 
 macro(WEBKIT_CREATE_FORWARDING_HEADER _target_directory _file)
+    get_filename_component(_source_path "${CMAKE_SOURCE_DIR}/Source/" ABSOLUTE)
     get_filename_component(_absolute "${_file}" ABSOLUTE)
     get_filename_component(_name "${_file}" NAME)
-    set(_content "#include \"${_absolute}\"\n")
-    set(_filename "${_target_directory}/${_name}")
+    set(_target_filename "${_target_directory}/${_name}")
 
-    if (EXISTS "${_filename}")
-        file(READ "${_filename}" _old_content)
+    # Try to make the path in the forwarding header relative to the Source directory
+    # so that these forwarding headers are compatible with the ones created by the
+    # WebKit2 generate-forwarding-headers script.
+    string(REGEX REPLACE "${_source_path}/" "" _relative ${_absolute})
+
+    set(_content "#include \"${_relative}\"\n")
+
+    if (EXISTS "${_target_filename}")
+        file(READ "${_target_filename}" _old_content)
     endif ()
 
     if (NOT _old_content STREQUAL _content)
-        file(WRITE "${_filename}" "${_content}")
+        file(WRITE "${_target_filename}" "${_content}")
     endif ()
 endmacro()
 
@@ -226,7 +233,7 @@ macro(WEBKIT_CREATE_FORWARDING_HEADERS _framework)
     foreach (_file ${_files})
         file(READ "${_file}" _content)
         string(REGEX MATCH "^#include \"([^\"]*)\"" _matched ${_content})
-        if (_matched AND NOT EXISTS "${CMAKE_MATCH_1}")
+        if (_matched AND NOT EXISTS "${CMAKE_SOURCE_DIR}/Source/${CMAKE_MATCH_1}")
            file(REMOVE "${_file}")
         endif ()
     endforeach ()