Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: cmake: set scylla version strings as CACHED strings
before this change, add_version_library() is a single function which accomplishes two tasks: 1. build scylla-version target using 2. add an object library but this has two problems: 1. we should run `SCYLLA-VERSION-GEN` at configure time, instead of at build time. otherwise the targets which read from the SCYLLA-{VERSION, RELEASE, PRODUCT}-FILE cannot access them, unless they are able to read them in their build rules. but they always use `file(STRINGS ..)` to read them, and thsee `file()` command is executed at configure time. so, this is a dead end. 2. we repeat the `file(STRING ..)` multiple places. this is not ideal if we want to minimize the repeatings. so, to address this problem, in this change: 1. use `execute_process()` instead of `add_custom_command()` for generating these *-FILE files. so they are always ready at build time. this partially reverts bb7d99a. 2. extract `generate_scylla_version()` out of `add_version_library()`. so we can call the former much earlier than the latter. this would allow us to reference the variables defined by the `generate_scylla_version()` much earlier. 3. define cached strings in the extracted function, so that they can consumed by other places. 4. reference the cached variables in `build_submodule.cmake`. also, take this opportunity to fix the version string used in build_submodule.cmake: we should have used `scylla_version_tilde`. Signed-off-by: Kefu Chai <kefu.chai@scylladb.com> Closes #14769
- Loading branch information