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,807
    • Issues 3,807
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 8
    • Merge requests 8
  • 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
  • #23131

Closed
Open
Created Jan 20, 2022 by Maxime Chambonnet@maxzor

Add the possibility to install nested headers automatically

My use case: I package a development version of a binary package for Debian. I have headers in my source directory (they could be imported), that are spread across multiple nested sub-directories. I am looking for a handy way to preserve the directory structure of my headers when installing them.

Let's say the source directory of my project has myProjectSource/some/path/to/a/bunch/of/headers

I want to cut the bunch of grapes at the origin directory of my choosing, i.e. 'a'. That gives a relative path bunch/of/headers. I want the relative paths, of the N headers found in there, to be installed in the appropriate GNUInstallDirs: ${CMAKE_INSTALL_INCLUDEDIR}(/bunch/of/headers). And repeat the process for the next header "superdir" and its own nested headers.

As far as I understood, PUBLIC_HEADER flattens all in one directory which is not suited to FHS installations where headers are allowed to be nested and often do so. install(FILE/DIRECTORY) is not fathomable given the elegance of install(TARGET myTarget) that modern cmake strives for. All the while keeping the useful differentiation between private and public headers.

Edited Jan 20, 2022 by Maxime Chambonnet
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Assignee
Assign to
Time tracking