Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Allow PACKAGE_VERSION override #12113

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

bneradt
Copy link
Contributor

@bneradt bneradt commented Mar 20, 2025

Allow a user to override PACKAGE_VERSION via -DPACKAGE_VERSION= on the commandline.

Allow a user to override PACKAGE_VERSION via -DPACKAGE_VERSION= on the
commandline.
@bneradt bneradt added Build work related to build configuration or environment CMake work related to CMakes scripts or issues labels Mar 20, 2025
@bneradt bneradt added this to the 10.1.0 milestone Mar 20, 2025
@bneradt bneradt requested a review from cmcfarlen March 20, 2025 21:29
@bneradt bneradt self-assigned this Mar 20, 2025
@cmcfarlen cmcfarlen modified the milestones: 10.1.0, 10.2.0 Mar 21, 2025
@cmcfarlen
Copy link
Contributor

Consider this approach instead:

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b26d0e209..73f66e5a4 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -29,7 +29,10 @@ project(ats VERSION 10.2.0)
 set(TS_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
 set(TS_VERSION_MINOR ${PROJECT_VERSION_MINOR})
 set(TS_VERSION_MICRO ${PROJECT_VERSION_PATCH})
-set(TS_VERSION_STRING ${TS_VERSION_MAJOR}.${TS_VERSION_MINOR}.${TS_VERSION_MICRO})
+set(TS_VERSION_STRING
+    ${TS_VERSION_MAJOR}.${TS_VERSION_MINOR}.${TS_VERSION_MICRO}
+    CACHE STRING "The version string"
+)
 math(EXPR TS_VERSION_NUMBER "${TS_VERSION_MAJOR} * 1000000 + ${TS_VERSION_MINOR} * 1000 + ${TS_VERSION_MICRO}")

 # We make this a cache entry so that it can be configured to different values

TS_VERSION_STRING is also used in several configure_file calls to expand in header files etc. Overriding this cmake var will cascade through the build.

Copy link
Contributor

@cmcfarlen cmcfarlen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider overriding TS_VERSION_STRING instead.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
Build work related to build configuration or environment CMake work related to CMakes scripts or issues
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants