Skip to content

CMake: Make subdirectories their own projects #353

@LecrisUT

Description

@LecrisUT

I was thinking about this design, and I think I've found a compelling usecase:

  • by design, cmake does not have a way to install ctests. You can install the googletest, but that's not equivalent due to the usage of labels in ctest. Making it a separate CMake project would allow to call the ctest on already installed packages
  • if downstream does not package a binding like fortran, this can more easily be added by the user by importing the sub-project only
  • in principle it should be possible to redirect FetchContent/find_package to the top-level project. I'm not sure if FIND_PACKAGE_ARGS is needed, or if we can use export() only. Need to test this out. Worst case scenario, I bundle my back-ports
  • could make the top-level CMakeLists cleaner. I am on the fence for this one, we'll need to see how it looks in practice vs how much we obfuscate by moving to different folders

Metadata

Metadata

Assignees

Labels

enhancementSignificant ehancements

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions