[EFL] Build break with latest EFL 1.8 libraries.
[WebKit-https.git] / Source / cmake / EFLHelpers.cmake
index bf8fbf4..ab95c7f 100644 (file)
 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
-INCLUDE(CMakeParseArguments)
+include(CMakeParseArguments)
 
-FUNCTION(FIND_EFL_LIBRARY _name)
+function(FIND_EFL_LIBRARY _name)
     CMAKE_PARSE_ARGUMENTS(PARAM "" "LIBRARY" "HEADERS;HEADER_PREFIXES" ${ARGN})
 
-    STRING(TOUPPER ${_name} _name_upper)
-    SET(_version_found FALSE)
+    string(TOUPPER ${_name} _name_upper)
+    set(_version_found FALSE)
 
-    FOREACH (_current_header ${PARAM_HEADERS})
-        FIND_PATH(${_current_header}_INCLUDE_DIR NAMES ${_current_header} PATH_SUFFIXES ${PARAM_HEADER_PREFIXES})
-        LIST(APPEND ${_name}_INCLUDE_DIRS "${${_current_header}_INCLUDE_DIR}")
+    foreach (_current_header ${PARAM_HEADERS})
+        find_path(${_current_header}_INCLUDE_DIR NAMES ${_current_header} PATH_SUFFIXES ${PARAM_HEADER_PREFIXES})
 
-        IF (NOT _version_found)
-            SET (_header_path "${${_current_header}_INCLUDE_DIR}/${_current_header}")
-            IF (EXISTS ${_header_path})
-                FILE(READ "${_header_path}" _header_contents)
+        set(_header_path "${${_current_header}_INCLUDE_DIR}/${_current_header}")
+        if (EXISTS ${_header_path})
+            list(APPEND ${_name}_INCLUDE_DIRS "${${_current_header}_INCLUDE_DIR}")
 
-                STRING(REGEX MATCH "#define +${_name_upper}_VERSION_MAJOR +([0-9]+)" _dummy "${_header_contents}")
-                SET(_version_major "${CMAKE_MATCH_1}")
-                STRING(REGEX MATCH "#define +${_name_upper}_VERSION_MINOR +([0-9]+)" _dummy "${_header_contents}")
-                SET(_version_minor "${CMAKE_MATCH_1}")
+            if (NOT _version_found)
+                file(READ "${_header_path}" _header_contents)
 
-                IF (_version_major AND _version_minor)
-                    SET(_version_found TRUE)
-                ENDIF ()
-            ENDIF ()
-        ENDIF ()
-    ENDFOREACH ()
+                string(REGEX MATCH "#define +${_name_upper}_VERSION_MAJOR +([0-9]+)" _dummy "${_header_contents}")
+                set(_version_major "${CMAKE_MATCH_1}")
+                string(REGEX MATCH "#define +${_name_upper}_VERSION_MINOR +([0-9]+)" _dummy "${_header_contents}")
+                set(_version_minor "${CMAKE_MATCH_1}")
 
-    FIND_LIBRARY(${_name}_LIBRARIES NAMES ${PARAM_LIBRARY})
+                if (_version_major AND _version_minor)
+                    set(_version_found TRUE)
+                endif ()
+            endif ()
+        endif ()
+    endforeach ()
 
-    SET(${_name}_INCLUDE_DIRS ${${_name}_INCLUDE_DIRS} PARENT_SCOPE)
-    SET(${_name}_LIBRARIES ${${_name}_LIBRARIES} PARENT_SCOPE)
-    SET(${_name}_VERSION "${_version_major}.${_version_minor}" PARENT_SCOPE)
-ENDFUNCTION()
+    find_library(${_name}_LIBRARIES NAMES ${PARAM_LIBRARY})
+
+    set(${_name}_INCLUDE_DIRS ${${_name}_INCLUDE_DIRS} PARENT_SCOPE)
+    set(${_name}_LIBRARIES ${${_name}_LIBRARIES} PARENT_SCOPE)
+    set(${_name}_VERSION "${_version_major}.${_version_minor}" PARENT_SCOPE)
+endfunction()