Changeset 205672 in webkit


Ignore:
Timestamp:
Sep 8, 2016 3:54:51 PM (8 years ago)
Author:
clopez@igalia.com
Message:

[CMake] Build failure with GCC 6 (fatal error: stdlib.h: No such file or directory)
https://bugs.webkit.org/show_bug.cgi?id=161697

Reviewed by Michael Catanzaro.

Get the list of system includes from GCC and add it to the CMake
list of implicit includes. This way, CMake will filter any of this
directories from the list of includes when calling the compiler.

This avoids an issue with GCC 6 that causes build failures when
including the default include path as a system include (-isystem).

  • Source/cmake/OptionsCommon.cmake:
Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r205556 r205672  
     12016-09-08  Carlos Alberto Lopez Perez  <clopez@igalia.com>
     2
     3        [CMake] Build failure with GCC 6 (fatal error: stdlib.h: No such file or directory)
     4        https://bugs.webkit.org/show_bug.cgi?id=161697
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Get the list of system includes from GCC and add it to the CMake
     9        list of implicit includes. This way, CMake will filter any of this
     10        directories from the list of includes when calling the compiler.
     11
     12        This avoids an issue with GCC 6 that causes build failures when
     13        including the default include path as a system include (-isystem).
     14
     15        * Source/cmake/OptionsCommon.cmake:
     16
    1172016-09-07  Michael Catanzaro  <mcatanzaro@igalia.com>
    218
  • trunk/Source/cmake/OptionsCommon.cmake

    r204084 r205672  
    3636    set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fcolor-diagnostics")
    3737    set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fcolor-diagnostics")
     38endif ()
     39
     40# Ensure that the default include system directories are added to the list of CMake implicit includes.
     41# This workarounds an issue that happens when using GCC 6 and using system includes (-isystem).
     42# For more details check: https://bugs.webkit.org/show_bug.cgi?id=161697
     43macro(DETERMINE_GCC_SYSTEM_INCLUDE_DIRS _lang _compiler _flags _result)
     44    file(WRITE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy" "\n")
     45    separate_arguments(_buildFlags UNIX_COMMAND "${_flags}")
     46    execute_process(COMMAND ${_compiler} ${_buildFlags} -v -E -x ${_lang} -dD dummy
     47                    WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/CMakeFiles OUTPUT_QUIET
     48                    ERROR_VARIABLE _gccOutput)
     49    file(REMOVE "${CMAKE_BINARY_DIR}/CMakeFiles/dummy")
     50    if ("${_gccOutput}" MATCHES "> search starts here[^\n]+\n *(.+) *\n *End of (search) list")
     51        set(${_result} ${CMAKE_MATCH_1})
     52        string(REPLACE "\n" " " ${_result} "${${_result}}")
     53        separate_arguments(${_result})
     54    endif ()
     55endmacro()
     56
     57if (CMAKE_COMPILER_IS_GNUCC)
     58   DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c" "${CMAKE_C_COMPILER}" "${CMAKE_C_FLAGS}" SYSTEM_INCLUDE_DIRS)
     59   set(CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
     60endif ()
     61
     62if (CMAKE_COMPILER_IS_GNUCXX)
     63   DETERMINE_GCC_SYSTEM_INCLUDE_DIRS("c++" "${CMAKE_CXX_COMPILER}" "${CMAKE_CXX_FLAGS}" SYSTEM_INCLUDE_DIRS)
     64   set(CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES ${CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES} ${SYSTEM_INCLUDE_DIRS})
    3865endif ()
    3966
Note: See TracChangeset for help on using the changeset viewer.