Skip to content

GitLab

  • Menu
Projects Groups Snippets
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • CMake CMake
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 3,801
    • Issues 3,801
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 15
    • Merge requests 15
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Releases
  • Packages & Registries
    • Packages & Registries
    • Container Registry
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • External wiki
    • External wiki
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • CMake
  • CMakeCMake
  • Issues
  • #23061

Closed
Open
Created Dec 30, 2021 by Sergey Galanov@sergey.e.galanov

C++ header dependencies are incorrect with CXX=clang++

$ cat test.cpp
#include <stdlib.h>
void f()
{
}

$ cat CMakeLists.txt
PROJECT(test)
add_library(test test.cpp)

With clang compiler this project is getting rebuilt every time I run make because of the dependence to the C++ version of stdlib.h. The reason seems to be that the dependence is generated as '/include/c++/11.1.0/stdlib.h' instead of '/usr/include/c++/11.1.0/stdlib.h', and that prerequisite is not found. The issue goes away if I do any of the following:

  • build with gcc;
  • rename test.cpp to test.c;
  • change stdlib.h to stdio.h (there is no C++ version of stdio.h);
  • downgrade to cmake 3.19.6 (but it doesn't seem to record any system C++ header deps).
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking