Skip to content

Commit

Permalink
build: fix build labels on GitHub Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
ericwa committed Aug 14, 2023
1 parent 3f8042f commit 3a054c1
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,17 @@ execute_process(
OUTPUT_VARIABLE GIT_DESCRIBE
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "git describe returned \"${GIT_DESCRIBE}\"")

# git describe fails on GitHub Actions
if(NOT GIT_DESCRIBE)
# See: https://docs.github.com/en/actions/reference/environment-variables#default-environment-variables
if(NOT ("$ENV{GITHUB_REF_NAME}" STREQUAL ""))
set(GIT_DESCRIBE "$ENV{GITHUB_REF_NAME}")

message(STATUS "using version label \"${GIT_DESCRIBE}\" from GITHUB_REF_NAME")
endif()
endif()

if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND CMAKE_CXX_SIMULATE_ID STREQUAL "MSVC")
add_compile_options(/EHsc)
Expand Down

0 comments on commit 3a054c1

Please sign in to comment.