Hunter offers an automated setup powered by a single FetchContent, which is a really convenient way to keep the gate itself up to date. The major side-effect of this approach is that it enforces a declarative approach which heavily limits the versatility (and locality) of the project dependencies logic.
- The major drawback is that the
hunter_config() and hunter_add_package() functions aren't available anymore. This prevents the project's dependencies logic to take advantage of natural CMake features like add_subdirectory() and localized scope.
- Unavailable data: sometimes all information that can affect dependencies is simply not available before evaluating any further code. This includes targets, target properties, or subdirectory-specific data.
- Global scope pollution: variables that should belong to a subdirectory only must be moved up to the root
CMakeLists.txt file.
- Duplicated conditional logic (splitted
if() branches): optional operations dependent on the same condition need to be split between "dependencies-affecting operations" and "other operations". This leads to duplicated code and potential errors.
On the other hand, detecting and downloading the latest "classic" hunter gate is not a trivial operation to do in CMake, especially if done properly: already existing hunter setup code should be preferred to a custom one.
My proposal is to add an option like HUNTER_DOWNLOAD_ONLY to disable everything beyond the latest hunter gate download, and let users use it as described in the docs.
I hope I made sense and made no blunders 😅.
Hunter offers an automated setup powered by a single
FetchContent, which is a really convenient way to keep the gate itself up to date. The major side-effect of this approach is that it enforces a declarative approach which heavily limits the versatility (and locality) of the project dependencies logic.hunter_config()andhunter_add_package()functions aren't available anymore. This prevents the project's dependencies logic to take advantage of natural CMake features likeadd_subdirectory()and localized scope.CMakeLists.txtfile.if()branches): optional operations dependent on the same condition need to be split between "dependencies-affecting operations" and "other operations". This leads to duplicated code and potential errors.On the other hand, detecting and downloading the latest "classic" hunter gate is not a trivial operation to do in CMake, especially if done properly: already existing hunter setup code should be preferred to a custom one.
My proposal is to add an option like
HUNTER_DOWNLOAD_ONLYto disable everything beyond the latest hunter gate download, and let users use it as described in the docs.I hope I made sense and made no blunders 😅.