mirror of
https://github.com/obsproject/obs-studio.git
synced 2024-09-20 13:08:50 +02:00
e2e3c9e102
Include guards ensure that bootstrap includes happen only once for the entire project. Moving all policy changes into an included file without its own policy scope ensures that the policy is applied to the project.
22 lines
695 B
CMake
22 lines
695 B
CMake
# OBS CMake build number module
|
|
|
|
include_guard(GLOBAL)
|
|
|
|
# Define build number cache file
|
|
set(_BUILD_NUMBER_CACHE
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/.CMakeBuildNumber"
|
|
CACHE INTERNAL "OBS build number cache file")
|
|
|
|
# Read build number from cache file or manual override
|
|
if(NOT DEFINED OBS_BUILD_NUMBER AND EXISTS "${_BUILD_NUMBER_CACHE}")
|
|
file(READ "${_BUILD_NUMBER_CACHE}" OBS_BUILD_NUMBER)
|
|
math(EXPR OBS_BUILD_NUMBER "${OBS_BUILD_NUMBER}+1")
|
|
elseif(NOT DEFINED OBS_BUILD_NUMBER)
|
|
if($ENV{CI} AND $ENV{GITHUB_RUN_ID})
|
|
set(OBS_BUILD_NUMBER "$ENV{GITHUB_RUN_ID}")
|
|
else()
|
|
set(OBS_BUILD_NUMBER "1")
|
|
endif()
|
|
endif()
|
|
file(WRITE "${_BUILD_NUMBER_CACHE}" "${OBS_BUILD_NUMBER}")
|