Refactor CMake configuration and versioning system#8
Merged
Conversation
- Replaced the manual versioning system with automated versioning using the `cmake-git-versioning` module, enhancing maintainability. - Updated `CMakeLists.txt` to utilize the new versioning approach and removed the obsolete `get_version_from_git.cmake` script. - Changed the version header from `version.h` to `version.hpp` to align with C++ naming conventions. - Added `CPM.cmake` for improved package management and dependency handling. These changes streamline the build process and improve version management based on Git tags.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the CMake build configuration to replace a manual Git-based versioning system with an automated solution using the cmake-git-versioning module from an external repository. The changes introduce CPM.cmake for dependency management and update the version file naming convention from .h to .hpp.
Key Changes:
- Replaced custom
get_version_from_git.cmakescript withcmake-git-versioningexternal module - Added
CPM.cmake(1363 lines) for package management - Updated
.gitignoreto trackversion.hppinstead ofversion.h
Reviewed changes
Copilot reviewed 4 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
CMakeLists.txt |
Refactored to use cmake-git-versioning module; removed manual version configuration; updated to fetch dependency via CPM |
cmake/CPM.cmake |
Added CMake Package Manager for dependency handling |
cmake/get_version_from_git.cmake |
Removed custom Git versioning script (replaced by external module) |
include/cpp_core/version.h.in |
Removed template file (replaced by cmake-git-versioning output) |
.gitignore |
Updated to ignore version.hpp instead of version.h |
Critical Issues Found:
- File naming inconsistency: The
.gitignoreand PR description indicate a switch toversion.hpp, but all existing code still referencesversion.h, which will cause build failures - CMake variable syntax error: Line 15 uses incorrect variable reference syntax that may not work with CMake
- Project initialization order: External dependencies are fetched before calling
project(), which violates CMake best practices
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- Changed header file references from `version.h` to `version.hpp` in `cpp_core.h`, `serial.h`, and `get_version.h` to maintain consistency with C++ naming conventions. - Added a new `Version` struct in `get_version.h` to encapsulate version information, improving clarity and usability when accessing version details. These modifications enhance code organization and align with recent refactoring efforts.
697b85d to
c510c22
Compare
Mqxx
approved these changes
Dec 3, 2025
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.
cmake-git-versioningmodule, enhancing maintainability.CMakeLists.txtto utilize the new versioning approach and removed the obsoleteget_version_from_git.cmakescript.version.htoversion.hppto align with C++ naming conventions.CPM.cmakefor improved package management and dependency handling.These changes streamline the build process and improve version management based on Git tags.