Releases: stlab/cpp-library
v5.1.1
What's Changed
- Fixed an issue with untracked dependencies breaking non-install builds.
- Revise README and improve untracked dependency handling by @sean-parent in #17
Full Changelog: v5.1.0...v5.1.1
v5.1.0
Adding support for BUILD_INTERFACE for auto-generated dependencies for re-exported headers.
v5.0.0
Release Notes - Version 5.0.0
Overview
This release represents a major enhancement to cpp-library's installation and dependency management infrastructure. The primary focus is on introducing a CMake dependency provider system that accurately tracks and generates installation dependencies, along with numerous improvements to the setup process, testing infrastructure, and developer experience.
Breaking Changes
CMake Version Requirement
- Removed support for CMake < 3.24: The library now requires CMake 3.24 or later due to the use of the dependency provider feature.
- Rationale: This allows for more accurate and reliable dependency tracking during installation.
Setup Function Order Changes
-
Updated required order for CMake setup: Projects must now call functions in this order:
cpp_library_enable_dependency_tracking()(beforeproject())project()declarationcpp_library_setup()(afterproject())include(CTest)(explicitly, if tests/examples are used)
-
Impact: Existing projects will need to update their CMakeLists.txt to follow the new order.
CMake Presets Changes
- CPM_SOURCE_CACHE moved to presets: CPM cache configuration moved from CMakeLists.txt to CMakePresets.json for automatic setup.
New Features
Installation Support
The most significant addition in this release is comprehensive installation support with accurate dependency tracking:
-
CMake Dependency Provider: Implemented a custom dependency provider that tracks all
find_package()calls during configuration and automatically generates properfind_dependency()calls in the installed CMake config files. -
Component Merging: Multiple
find_package()calls for the same package with different components are now correctly merged, preventing duplicates and preserving optional components. -
Custom Dependency Mapping: Added support for custom dependency mapping to handle cases where the installed package name differs from the find_package name (e.g., Qt6 components).
-
QUIET Dependency Handling: The dependency provider now correctly filters out dependencies from
find_package()calls with the QUIET flag when the package is not found. -
Version Override Support: Projects can override dependency versions in the generated config files.
Interactive Setup Script (WIP)
- setup.cmake: New interactive setup script that guides users through creating a new library project with the correct structure.
- Auto-detects the current cpp-library version from git tags
- Prompts for library name, namespace, description, and options
- Generates all necessary files with proper structure
- Downloads dependencies automatically
CI/CD Improvements
- Template-based CI workflow: The CI workflow file is now generated from a template (
ci.yml.in) during project setup, allowing for customization. - Conditional CMake steps: CI workflow now conditionally runs CMake steps based on project configuration.
- Dependency mapping tests: Added comprehensive tests for dependency mapping and provider functionality.
- Provider merging tests: Added tests to verify component merging behavior.
Improvements
Documentation
- README simplification: Removed design rationale and redundant examples for clarity.
- Version standardization: Replaced hardcoded version numbers with placeholders (X.Y.Z) in documentation and templates, encouraging users to check for the latest release.
- Usage clarification: Improved documentation about required setup order and dependency tracking.
- Troubleshooting added: Added troubleshooting section for common issues.
- CPM cache documentation: Updated docs to reflect CPM_SOURCE_CACHE configuration in presets.
CMake Infrastructure
- Header guard generation: Enhanced to sanitize names by replacing hyphens with underscores and converting to uppercase.
- Error messaging: Improved error messages throughout to clarify common issues and provide guidance.
- Regex safety: Enhanced regex handling for special characters in package names, versions, and components.
- Property handling: Improved global property handling for tracking dependencies and packages.
- CONFIG flag preservation: Fixed bug where CONFIG flag was lost when merging dependency calls without components.
- Keyword filtering: Keywords (CONFIG, NO_MODULE, REQUIRED) are now properly filtered from component lists to prevent them being treated as components.
Testing Infrastructure
- CTest integration: Improved integration with CTest by deferring
enable_testing()to directory scope usingcmake_language(EVAL CODE ...). - Test organization: Better organization of install tests with dedicated test files.
- Integration examples: Added comprehensive integration example demonstrating correct usage patterns.
Development Tools
- clang-tidy MSVC support: Added workaround to automatically append
--extra-arg=/EHscto CMAKE_CXX_CLANG_TIDY when using MSVC, addressing exception handling flag issues. - clangd integration: Maintained and improved clangd support for better IDE integration.
Dependency Management
- CPM.cmake integration: Maintained compatibility with CPM while improving installation behavior.
- Package name consistency: Introduced PACKAGE_NAME parameter for consistent target and package naming.
- Argument parsing: Improved argument parsing to handle package names and version numbers with regex metacharacters.
Version Detection
- Git tag-based versioning: Enhanced automatic version detection from git tags with better fallback handling.
- Semantic versioning validation: Added validation to ensure proper semantic versioning format.
Bug Fixes
- Fixed CONFIG flag preservation: CONFIG flag is now preserved when merging find_package calls without components.
- Fixed component merging: CONFIG, NO_MODULE, and REQUIRED keywords no longer treated as components.
- Fixed namespace prefix escaping: Corrected regex handling when escaping namespace prefixes for clean name calculation.
- Fixed version extraction: Improved version extraction logic to enforce semantic versioning format.
- Fixed QUIET dependency handling: Phantom dependencies from failed QUIET find_package calls are no longer included in config files.
- Fixed enable_testing() timing: Changed to use EVAL CODE instead of DEFER DIRECTORY for immediate execution at parent directory scope.
- Fixed quoting issues: Resolved various quoting issues in Windows bash environments.
- Fixed CI test project: Corrected usage order demonstration in CI test project.
Testing
New Tests Added
test_dependency_mapping.cmake: Comprehensive tests for dependency mapping functionalitytest_dependency_provider.cmake: Tests for dependency provider core functionalitytest_provider_merge.cmake: Tests for component merging behaviortest_integration_example.txt: Complete integration example demonstrating correct usage
Test Infrastructure
- Install test suite with dedicated CMakeLists.txt
- Provider merging tests in CI pipeline
- Conditional test execution based on project configuration
Migration Guide
For Existing Projects
If you're upgrading from v4.0.5 or earlier, you'll need to make the following changes:
-
Update CMake minimum version to 3.24:
cmake_minimum_required(VERSION 3.24)
-
Update setup function order in your CMakeLists.txt:
# Enable dependency tracking BEFORE project() cpp_library_enable_dependency_tracking() # Declare your project project(your-library) # If you have tests or examples, explicitly include CTest include(CTest) # Setup cpp-library AFTER project() cpp_library_setup(...)
-
Update CMakePresets.json:
- Remove any
installpreset entries - Add
CPM_SOURCE_CACHEto cache variables in your presets if desired
- Remove any
-
Review dependency tracking:
- Ensure all
find_package()calls happen aftercpp_library_enable_dependency_tracking() - Add custom dependency mappings if needed for packages with non-standard names
- Ensure all
-
Update CI workflow (if using the template):
- The CI workflow is now generated from
ci.yml.intemplate - Review and update your workflow based on the new template
- The CI workflow is now generated from
Links
- Pull Request #12 - Using a dependency provider to generate install dependencies
- Full Changelog
v4.0.5
What's Changed
Note
Removes install/package config generation, updates Doxygen theme to 2.4.1 with Windows quoting fix, refreshes CI actions, and adjusts README to set CPM cache only when top-level.
- Core (CMake):
- Remove install/export/package config generation and
$<INSTALL_INTERFACE:include>usage incmake/cpp-library-setup.cmake.
- Remove install/export/package config generation and
- Docs:
- Bump
doxygen-awesome-cssto2.4.1and fix PowerShell quoting for Doxygen incmake/cpp-library-docs.cmake. - Update
templates/custom.csscomment to reflect2.4.1.
- Bump
- CI/CD:
- Update Actions versions in
templates/.github/workflows/ci.yml(e.g.,actions/checkout@v5,actions/upload-pages-artifact@v4) and minor workflow cleanups.
- Update Actions versions in
- README:
- Recommend setting
CPM_SOURCE_CACHEonly whenPROJECT_IS_TOP_LEVEL. - Reflect removal of installation mention and update theme/version references; minor formatting improvements.
- Recommend setting
- Cleanup by @sean-parent in #7
Full Changelog: v4.0.3...v4.0.4
v4.0.3
Updated jothepro/doxygen-awesome-css@2.4.0
v4.0.2
What's Changed
- Update Doxyfile.in by @sean-parent in #4
MAX_INITIALIZER_LINES = 0
MULTILINE_CPP_IS_BRIEF = YES
WARN_AS_ERROR = YES
Full Changelog: v4.0.1...v4.0.2
v4.0.1
Doc preset target fixed to work around a VSCode bug.
Doxygen warnings are now reported to the CMake/build output
Patched a doxygen-awesome-css issue for template formatting.
Enabled the DISTRIBUTE_GROUP_DOC feature of Doxygen to simplify documenting related functions.
v4.0.0
- Removed unneeded option
- Simplified file lists
- Added negative compilation tests (already had for examples)
- Tests now only build with the test preset
Full Changelog: v3.0.0...v4.0.0
v3.0.0
- Fixed an issue where FORCE_INIT was defaulting to ON
- Removed several customization options to simplify configuration (and removed unimplemented options)
v2.0.0
What's Changed
VERSIONis now pickup up from git tags so it is always correct for a release.NAMEis used from the CMakeproject(name)at the top-level CMake.
See updated README.md for use.
- Adding support to automatically version from github tag by @sean-parent in #2
Full Changelog: v1.1.2...v2.0.0