2022-04-16 20:26:45 +03:00
|
|
|
cmake_minimum_required(VERSION 3.16.3)
|
2020-04-26 21:44:07 +03:00
|
|
|
|
|
|
|
# CMake options.
|
|
|
|
set(CMAKE_ERROR_DEPRECATED TRUE)
|
2017-02-18 05:34:07 +03:00
|
|
|
set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
|
2023-09-08 07:00:46 +03:00
|
|
|
project(Zeal
|
2023-10-02 05:28:14 +03:00
|
|
|
VERSION 0.7.1
|
2023-09-08 07:00:46 +03:00
|
|
|
DESCRIPTION "A simple documentation browser."
|
|
|
|
HOMEPAGE_URL "https://zealdocs.org"
|
|
|
|
LANGUAGES CXX
|
|
|
|
)
|
2020-09-21 08:53:12 +03:00
|
|
|
|
|
|
|
# Set to TRUE for a tagged release.
|
|
|
|
# NOTE: Don't forget to add a new release entry in the AppStream metadata!
|
2023-09-18 08:51:59 +03:00
|
|
|
if(NOT ZEAL_RELEASE_BUILD AND DEFINED ENV{ZEAL_RELEASE_BUILD})
|
|
|
|
set(ZEAL_RELEASE_BUILD $ENV{ZEAL_RELEASE_BUILD})
|
|
|
|
endif()
|
2017-02-18 05:34:07 +03:00
|
|
|
|
|
|
|
# Project information.
|
2023-09-08 07:00:46 +03:00
|
|
|
set(PROJECT_COMPANY_NAME "Oleg Shparber")
|
2024-05-28 15:14:35 +03:00
|
|
|
set(PROJECT_COPYRIGHT "© 2013-2024 Oleg Shparber and other contributors")
|
2017-02-18 05:34:07 +03:00
|
|
|
|
2022-10-02 22:04:33 +03:00
|
|
|
# Find available major Qt version. It will be stored in QT_VERSION_MAJOR.
|
|
|
|
find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
|
|
|
|
if(QT_VERSION_MAJOR EQUAL 6)
|
|
|
|
set(QT_MINIMUM_VERSION 6.2.0)
|
|
|
|
else()
|
|
|
|
set(QT_MINIMUM_VERSION 5.9.5)
|
|
|
|
endif()
|
2018-01-07 18:10:44 +03:00
|
|
|
|
2020-09-21 08:53:12 +03:00
|
|
|
# Determine version for dev builds.
|
2023-09-11 07:55:00 +03:00
|
|
|
if(NOT ZEAL_RELEASE_BUILD)
|
2021-01-30 21:52:45 +03:00
|
|
|
message(NOTICE "Building unreleased code. Proceed at your own risk!")
|
2020-09-21 08:53:12 +03:00
|
|
|
|
|
|
|
# TODO: Add support for metadata passed from env, e.g. aur, appimage, etc.
|
|
|
|
include(GetVersionFromGit)
|
|
|
|
if(Zeal_GIT_VERSION_SHA)
|
|
|
|
# Extra check in case we forgot to bump version in project() directive.
|
|
|
|
if(NOT PROJECT_VERSION_PATCH EQUAL Zeal_GIT_VERSION_PATCH_NEXT)
|
2023-09-18 08:51:59 +03:00
|
|
|
message(WARNING "Incorrect patch version! Forgot to bump?")
|
2020-09-21 08:53:12 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ZEAL_VERSION_SUFFIX "-dev.${Zeal_GIT_VERSION_AHEAD}+${Zeal_GIT_VERSION_SHA}")
|
|
|
|
else()
|
|
|
|
set(ZEAL_VERSION_SUFFIX "-dev")
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(ZEAL_VERSION_FULL "${Zeal_VERSION}${ZEAL_VERSION_SUFFIX}")
|
2023-03-20 09:21:26 +03:00
|
|
|
message(NOTICE "Calculated Zeal version: ${ZEAL_VERSION_FULL}")
|
2020-09-21 08:53:12 +03:00
|
|
|
|
2023-09-11 07:55:00 +03:00
|
|
|
file(WRITE "${CMAKE_BINARY_DIR}/zeal_version" ${ZEAL_VERSION_FULL})
|
2023-03-20 09:23:57 +03:00
|
|
|
|
2020-09-21 08:53:12 +03:00
|
|
|
# A custom target to print the full version.
|
2023-09-08 07:00:46 +03:00
|
|
|
# Usage: cmake --build build --preset ninja-multi-vcpkg-release --target zeal_version
|
2020-09-21 08:53:12 +03:00
|
|
|
add_custom_target(zeal_version
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E echo "Zeal version: ${ZEAL_VERSION_FULL}"
|
|
|
|
VERBATIM
|
|
|
|
)
|
|
|
|
|
2022-10-03 00:40:47 +03:00
|
|
|
if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.24.0")
|
|
|
|
set(CMAKE_COMPILE_WARNING_AS_ERROR ON)
|
|
|
|
endif()
|
|
|
|
|
2017-02-18 05:34:07 +03:00
|
|
|
add_subdirectory(assets)
|
|
|
|
add_subdirectory(src)
|