Requirements/Optional dependencies file
It would be nice to have a meta file like in the case of pyproject.toml that contains static requirements and optional dependencies. This is because distro packagers can than make the requirements be dynamic and significantly lessen the packaging burden.
This would be in parallel to the find_package and FetchContent inside the CMakeLists which should then handle only dynamic requirements. Making options to enable such requirements might still need to be done manually, but maybe these can be wrapped in a standardized cmake option like CMAKE_<Project_name>_OPTIONAL_DEPENDENCIES
.
On the backend this would simply call either find_package or FetchContent_Declare (with find_package_args) depending on the text format. This would handle both module and config packages, and configuration flags can then be set in the CMakeLists file prior to calling FetchContent_MakeAvailable or equivalent.
The frontend is a bit trickier because it would be nice to have project metadata stored there too, but then the options definitions should happen after the call to project in order to process PROJECT_IS_TOPLEVEL
, etc. properly. Maybe this can be handled with appropriate interface to handle individual dependencies prior to a FetchContent_MakeAvailable equivalent call for project metadata, i.e. a function that populates nonessential metadata (other than project name).