Skip to content

Header Relocatability, main branch (2024.06.03.)

After discussing about it in the S&C Workshop today, these are updates needed to put the project's public headers into a unique directory using CMAKE_INSTALL_INCLUDEDIR. Many of the libraries had this set up correctly already, but many of them had include hardcoded for the directory that would be picked up by the clients. (Everything was using ${CMAKE_INSTALL_INCLUDEDIR} correctly for the corresponding install(...) commands already.)

The end-goal here is to be able to do this sort of a thing:

cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_INCLUDEDIR="include/GeoModel" -S GeoModel -B build

Which would then result in an installed directory layout like:

├── include
│   └── GeoModel
│       ├── GeoGenericFunctions
│       ├── GeoModelDBManager
│       ├── GeoModelHelpers
│       ├── GeoModelIOHelpers
│       ├── GeoModelKernel
│       ├── GeoModelRead
│       ├── GeoModelWrite
│       └── TFPersistification
└── lib
    └── cmake
        ├── GeoModelCore
        └── GeoModelIO

, instead of the default:

├── include
│   ├── GeoGenericFunctions
│   ├── GeoModelDBManager
│   ├── GeoModelHelpers
│   ├── GeoModelIOHelpers
│   ├── GeoModelKernel
│   ├── GeoModelRead
│   ├── GeoModelWrite
│   └── TFPersistification
└── lib
    └── cmake
        ├── GeoModelCore
        └── GeoModelIO

What's more, the generated CMake code (after this MR) also respects this layout. 😉

# Create imported target GeoModelCore::GeoModelKernel
add_library(GeoModelCore::GeoModelKernel SHARED IMPORTED)

set_target_properties(GeoModelCore::GeoModelKernel PROPERTIES
  INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include/GeoModel"
  INTERFACE_LINK_LIBRARIES "Eigen3::Eigen;GeoModelCore::GeoGenericFunctions;dl"
)

(This MR is all about this very last thing.)

Pinging @boudreau, @emoyse, @pagessin.

P.S. Since I use VSCode, I'm also sneaking a convenience update into this MR. 😛

Merge request reports

Loading