0
0
mirror of https://github.com/fralx/LimeReport.git synced 2025-04-02 15:33:46 +03:00
LimeReport/cmake/modules/GenerateVersionHeader.cmake
Константин Макаренков ebbf2b7beb Fixed build issues
Fixed build with cmake when including limereport as a submodule with add_subdirectory(...)
Removed unnecessary checks of ENABLE DIALOG DESIGNER in CMakeLists.txt
Fixed Qt 5.15.16 incompatibility
Added missing LIMEREPORT_EXPORT
Fixed warnings
2025-03-12 14:30:56 +03:00

29 lines
901 B
CMake

find_package(Git)
if(GIT_EXECUTABLE)
# Generate a git-describe version string from Git repository tags
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags --dirty
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_DESCRIBE_VERSION
RESULT_VARIABLE GIT_DESCRIBE_ERROR_CODE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_DESCRIBE_ERROR_CODE)
set(GIT_VERSION ${GIT_DESCRIBE_VERSION})
endif()
endif()
# Final fallback: Just use a bogus version string that is semantically older
# than anything else and spit out a warning to the developer.
if(NOT DEFINED GIT_VERSION)
set(GIT_VERSION 0.0.0-unknown)
message(WARNING "Failed to determine version from Git tags. Using default version \"${GIT_VERSION}\".")
endif()
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/limereport/version.h.in
${CMAKE_CURRENT_BINARY_DIR}/limereport/version.h
@ONLY)