1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
# SPDX-License-Identifier: GPL-2.0-or-later
cmake_minimum_required(VERSION 3.10)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
set(HARDCODED_VERSION "0.4.1")
set(IS_RELEASE TRUE)
if(IS_RELEASE)
set(GIT_PROJECT_VER "${HARDCODED_VERSION}")
else()
# Ask git for the version number
execute_process(COMMAND git describe --tags --dirty
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_PROJECT_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
if(NOT GIT_PROJECT_VER)
# Try asking dpkg-parsechangelog for a version number
execute_process(COMMAND dpkg-parsechangelog -S Version
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
OUTPUT_VARIABLE GIT_PROJECT_VER
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# Did dpkg-parsechangelog fail too?
if(NOT GIT_PROJECT_VER)
set(GIT_PROJECT_VER "${HARDCODED_VERSION}-unknown")
elseif(NOT(GIT_PROJECT_VER MATCHES "-"))
set(GIT_PROJECT_VER "${GIT_PROJECT_VER}-deb")
endif()
endif()
endif()
string(REGEX REPLACE "-.*" "" PARSED_PROJECT_VER "${GIT_PROJECT_VER}")
project("alarm-clock-applet" VERSION "${PARSED_PROJECT_VER}" LANGUAGES C)
# Manually set the version string to keep the suffix
set(PROJECT_VERSION "${GIT_PROJECT_VER}")
if(NOT(PARSED_PROJECT_VER VERSION_EQUAL HARDCODED_VERSION))
message(AUTHOR_WARNING "Hardcoded version is not equal to git version. Please correct it!")
endif()
include_directories("${CMAKE_BINARY_DIR}")
include(GNUInstallDirs)
find_package(PkgConfig REQUIRED)
find_package(Gettext REQUIRED)
# Uninstall target
add_custom_target(uninstall
COMMAND xargs -r -t rm -f < "${CMAKE_BINARY_DIR}/install_manifest.txt"
)
option(ENABLE_GCONF_MIGRATION "Enables GConf to GSettings migration for existing alarms (and adds a dependency to GConf)." ON)
option(ALLOW_MISSING_GCONF "Allows the project to build with GConf missing. Useful for existing installations (AUR) that already had GConf." OFF)
if(ENABLE_GCONF_MIGRATION)
add_subdirectory("gconf-migration")
endif()
option(WITH_MANPAGE_COMPRESSION "Compresses the manpage with Gzip if installed." ON)
add_compile_options("-Wshadow"
"-Werror=return-type"
)
add_subdirectory("po")
add_subdirectory("src")
|