Fix CMake compatibility issues with Hunter dependencies#325
Merged
turuslan merged 1 commit intolibp2p:masterfrom Sep 3, 2025
Merged
Fix CMake compatibility issues with Hunter dependencies#325turuslan merged 1 commit intolibp2p:masterfrom
turuslan merged 1 commit intolibp2p:masterfrom
Conversation
Contributor
Author
|
@turuslan Could you please review this PR when you get a chance? |
turuslan
approved these changes
Sep 3, 2025
Contributor
|
Thank you for your contribution |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
The cpp-libp2p repository was failing to build on modern systems due to CMake compatibility issues with several Hunter package dependencies. These packages had outdated CMake configurations that required CMake < 3.5, but modern CMake versions have removed support for that compatibility level.
Root Cause
Multiple Hunter packages were using outdated CMake configurations:
These packages contained
cmake_minimum_required(VERSION < 3.5)statements that are incompatible with modern CMake versions.Solution
Updated the Hunter configuration in
cmake/Hunter/config.cmaketo add custom configurations for each problematic dependency with theCMAKE_POLICY_VERSION_MINIMUM=3.5flag. This ensures compatibility with modern CMake versions while maintaining the existing package versions.Changes Made
cmake/Hunter/config.cmake
hunter_configfor Protobuf with CMake compatibility flagshunter_configfor c-ares with CMake compatibility flagshunter_configfor yaml-cpp with CMake compatibility flagshunter_configfor Boost.DI with CMake compatibility flagsCMakeLists.txt
CMP0144andCMP0000policies for better compatibilityTesting
Before/After
Before: Build failed with errors like:
After: Build completes successfully with all targets compiled.
Impact
Related Issues
This fix addresses build failures that were preventing users from compiling the cpp-libp2p library on systems with current CMake versions.
Notes