Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
CMake
CMake
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,304
    • Issues 3,304
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Merge Requests 10
    • Merge Requests 10
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Incidents
    • Environments
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • External Wiki
    • External Wiki
  • Members
    • Members
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #16291

Closed
Open
Created Sep 08, 2016 by Carlos Alberto Lopez Perez@clopez

Detect GCC system include paths at run-time and automatically add them to CMAKE_${LANG}_IMPLICIT_INCLUDE_DIRECTORIES

Hi,

GCC 6 has introduced a change that broke some C++ projects when the project uses system includes (-isystem) via passing the parameter SYSTEM to CMake's functions include_directories or target_include_directories.

This didn't broke the 99% of the standard builds because CMAKE_C_IMPLICIT_INCLUDE_DIRECTORIES and CMAKE_CXX_IMPLICIT_INCLUDE_DIRECTORIES already default to /usr/include. So CMake automatically filters /usr/include from the list of includes when calling the compiler.

But when cross-compiling or when using a non-default system include directory, the build breaks.

On the WebKit project we work-around'ed this by calling GCC at run-time to obtain the list of system includes, to automatically add this directories to the above variables.

Perhaps it makes sense to introduce this change in CMake itself, as I think it may be useful for everybody. It is also probably a good idea to avoid passing -I/-isystem for directories that the compiler already assumes as default include directories. It keeps thinga cleaner and simple.

  • The change we did is this one: https://trac.webkit.org/changeset/205672/trunk/Source/cmake/OptionsCommon.cmake

  • And here is the WebKit bug that contains details about this issue: https://bugs.webkit.org/show_bug.cgi?id=161697

  • The GCC bug report itself that got closed as wontfix is: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70129

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None