nextpnr/common/CMakeLists.txt
Catherine cd7f7c12f1 CMake: refactor architecture-specific build system parts.
Two user-visible changes were made:
* `-DUSE_RUST` is replaced with `-DBUILD_RUST`, by analogy with
  `-DBUILD_PYTHON`
* `-DCOVERAGE` was removed as it doesn't work with either modern GCC
  or Clang
2025-01-21 17:13:03 +00:00

21 lines
724 B
CMake

if (NOT DEFINED CURRENT_GIT_VERSION)
# Get the latest abbreviated commit hash of the working branch if not already defined outside
# (e.g. by package manager when building outside of git repository).
execute_process(
COMMAND git describe --tags --always
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE CURRENT_GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
endif()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/version.h.in ${CMAKE_CURRENT_BINARY_DIR}/version.h)
add_library(nextpnr_version INTERFACE)
target_include_directories(nextpnr_version INTERFACE ${CMAKE_CURRENT_BINARY_DIR})
target_sources(nextpnr_version INTERFACE
${CMAKE_CURRENT_BINARY_DIR}/version.h
)