Skip to content

Commit

Permalink
Use version.txt if present (eg. when it's a source code archive)
Browse files Browse the repository at this point in the history
  • Loading branch information
melroy89 committed Feb 19, 2024
1 parent 5e0bbb1 commit 6f3719b
Showing 1 changed file with 21 additions and 3 deletions.
24 changes: 21 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,34 @@
cmake_minimum_required (VERSION 3.20)

set(PROJECT_NAME libreweb-browser)

option(DOXYGEN "Build Doxygen documentation" ON)
option(UNITTEST "Build unit tests")
option(PACKAGE "Build packages in release mode" OFF)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11.0" CACHE STRING "Minimum macOS deployment version")

list(APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")

include(GitVersion)
# If we have a git folder, get GIT_TAG_VERSION from most recent git tag
if(EXISTS "${CMAKE_SOURCE_DIR}/.git")
include(GitVersion)
set(LOCAL_PROJECT_VERSION ${GIT_TAG_VERSION})
else()
# In source archives there is no .git folder present.
# If CUSTOM_PROJECT_VERSION is defined use it as version.
if(DEFINED CUSTOM_PROJECT_VERSION)
set(LOCAL_PROJECT_VERSION "${CUSTOM_PROJECT_VERSION}")
elseif(EXISTS "${CMAKE_SOURCE_DIR}/version.txt")
# Read version from version.txt file
file(READ "version.txt" LOCAL_PROJECT_VERSION)
else()
# Fallback to version 1.0.0
set(LOCAL_PROJECT_VERSION "1.0.0")
endif()
endif()

project(libreweb-browser
VERSION ${GIT_TAG_VERSION}
project({PROJECT_NAME}
VERSION ${LOCAL_PROJECT_VERSION}
DESCRIPTION "LibreWeb Browser - Decentralized Web-Browser"
LANGUAGES C CXX)

Expand Down

0 comments on commit 6f3719b

Please sign in to comment.