HackRF-Treasure-Chest/Software/portapack-mayhem/hackrf/host/cmake/set_release.cmake

27 lines
652 B
CMake
Raw Normal View History

2022-09-22 18:26:57 +02:00
#set(RELEASE "")
if(NOT DEFINED RELEASE)
execute_process(
COMMAND git log -n 1 --format=%h
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE GIT_EXIT_VALUE
ERROR_QUIET
OUTPUT_VARIABLE GIT_VERSION
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if (GIT_EXIT_VALUE)
set(RELEASE "unknown")
else (GIT_EXIT_VALUE)
execute_process(
COMMAND git status -s --untracked-files=no
OUTPUT_VARIABLE DIRTY
)
if ( NOT "${DIRTY}" STREQUAL "" )
set(DIRTY_FLAG "*")
else()
set(DIRTY_FLAG "")
endif()
set(RELEASE "git-${GIT_VERSION}${DIRTY_FLAG}")
endif (GIT_EXIT_VALUE)
endif()