-
Notifications
You must be signed in to change notification settings - Fork 273
Set CMake project version based on config.inc #5458
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Set CMake project version based on config.inc #5458
Conversation
Currently we set the CBMC version in config.inc. It would be useful to have this information in our CMakeLists.txt as well (especially for e.g. CPack packaging), and to avoid duplication it would be better to have it in just one place. It’s somewhat easier to parse config.inc from CMake than doing it the other way round (and we already do it in src/util/CMakeLists.txt anyway), we do it here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but I would appreciate a small comment on why we do it in the source - I know it's in the commit message, but something similar (smaller preferably) would be great to have in the code itself.
Codecov Report
@@ Coverage Diff @@
## develop #5458 +/- ##
========================================
Coverage 68.23% 68.23%
========================================
Files 1178 1178
Lines 97590 97590
========================================
Hits 66592 66592
Misses 30998 30998
Flags with carried forward coverage won't be shown. Click here to find out more. Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally looks good to me, and good to see this made consistent with the Makefile builds. A small query but not blocking.
project(CBMC VERSION ${CBMC_VERSION}) | ||
|
||
# when config.inc changes we’ll need to reconfigure to check if the version changed | ||
set_property(DIRECTORY APPEND PROPERTY CMAKE_CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/src/config.inc") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a general query about this - when does config.inc get generated? IIRC it gets auto generated using the git info? If so, when does that change, and what is the effect here? I'm slightly worried about whether this means every time you make a local change and re-build, it also causes a fresh re-configure? And if so, doesn't that also mean a fresh re-download of minisat?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chrisr-diffblue This string is static and currently only user set (plan is to autoincrement on release going forward). The git-tag string is also used but only for use in util/version.h
, which uses both this info and the git-tag.
The reason we keep the two separate is to support builds from source packages and shallow clones. So this will not trigger frequent reconfigures.
As I believe I’ve mentioned before as well a long term goal of mine is for us to stop downloading things off the internet in our CMakeLists.txt
at all and instead provide the dependency downloading/building stuff as a separate script.
Currently we set the CBMC version in config.inc.
It would be useful to have this information in our CMakeLists.txt as
well (especially for e.g. CPack packaging), and to avoid duplication it
would be better to have it in just one place. It’s somewhat easier to
parse config.inc from CMake than doing it the other way round (and we
already do it in src/util/CMakeLists.txt anyway), we do it here.