Files
scylladb/cmake/add_version_library.cmake
Kefu Chai 957403663f build: cmake: build release.cc as a library
so we can attach compiling definitions in a simpler way.

this change is based on Botond Dénes's change which gives an overhaul
to the existing CMake building system.

Signed-off-by: Kefu Chai <kefu.chai@scylladb.com>
2023-02-21 14:23:04 +08:00

22 lines
798 B
CMake

###
### Generate version file and supply appropriate compile definitions for release.cc
###
function(add_version_library name source)
set(version_file ${CMAKE_CURRENT_BINARY_DIR}/SCYLLA-VERSION-FILE)
set(release_file ${CMAKE_CURRENT_BINARY_DIR}/SCYLLA-RELEASE-FILE)
execute_process(
COMMAND ${CMAKE_SOURCE_DIR}/SCYLLA-VERSION-GEN --output-dir "${CMAKE_CURRENT_BINARY_DIR}"
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR})
file(STRINGS ${version_file} scylla_version)
file(STRINGS ${release_file} scylla_release)
add_library(${name} OBJECT ${source})
target_compile_definitions(${name}
PRIVATE
SCYLLA_VERSION=\"${scylla_version}\"
SCYLLA_RELEASE=\"${scylla_release}\")
target_link_libraries(${name}
PRIVATE
Seastar::seastar)
endfunction(add_version_library)