Skip to content

Commit

Permalink
alternative approach using version.txt instead of directly calling gi…
Browse files Browse the repository at this point in the history
…t Alexander Taepper Today 16:27
  • Loading branch information
Taepper committed Jan 22, 2025
1 parent d663e6a commit 3815438
Showing 1 changed file with 18 additions and 18 deletions.
36 changes: 18 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,24 @@ set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_BINARY_DIR}/generators/")
# (looking for the <lib>-config.cmake files of transitive dependencies of modules, e.g. spdlog->fmt)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} "${CMAKE_BINARY_DIR}/generators/")

# ---------------------------------------------------------------------------
# Version
# ---------------------------------------------------------------------------

execute_process(
COMMAND cat version.txt
OUTPUT_VARIABLE VERSION
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE VERSION_AVAILABLE
)
if (VERSION_AVAILABLE EQUAL 0)
message(STATUS "Version: ${VERSION}")
add_compile_definitions(SILO_VERSION="${VERSION}")
else ()
message(STATUS "No version.txt available for setting the version")
endif()

# ---------------------------------------------------------------------------
# Logging
# ---------------------------------------------------------------------------
Expand All @@ -47,24 +65,6 @@ find_package(yaml-cpp REQUIRED)
find_package(zstd REQUIRED)
find_package(re2 REQUIRED)

# ---------------------------------------------------------------------------
# Version
# ---------------------------------------------------------------------------

execute_process(
COMMAND cat version.txt
OUTPUT_VARIABLE VERSION
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE VERSION_AVAILABLE
)
if (VERSION_AVAILABLE EQUAL 0)
message(STATUS "Version: ${VERSION}")
add_compile_definitions(SILO_VERSION="${VERSION}")
else ()
message(STATUS "No version.txt available for setting the version")
endif()

# ---------------------------------------------------------------------------
# Includes
# ---------------------------------------------------------------------------
Expand Down

0 comments on commit 3815438

Please sign in to comment.