1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/CMakeLists.txt

71 lines
1.8 KiB
Text
Raw Normal View History

2016-05-19 10:41:06 -04:00
#
# Build configuration
#
cmake_minimum_required(VERSION 3.5.0 FATAL_ERROR)
project(polybar CXX)
2016-05-24 08:24:45 -04:00
# Extract version information from version.txt. The first line that looks like
# a version string is used, so the file supports comments
file(STRINGS version.txt version_txt REGEX "^[0-9]+\\.[0-9]+\\.[0-9]+.*$" LIMIT_COUNT 1)
# If we are in a git repo we can get the version information from git describe
execute_process(COMMAND git describe --tags --dirty=-dev
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
RESULT_VARIABLE git_result
OUTPUT_VARIABLE git_describe
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
if(git_result EQUAL "0")
set(APP_VERSION "${git_describe}")
else()
message(STATUS "Could not detect version with git, falling back to built-in version information.")
set(APP_VERSION "${version_txt}")
endif()
2020-12-23 19:40:26 -05:00
list(APPEND CMAKE_MODULE_PATH
2016-11-02 15:22:45 -04:00
${PROJECT_SOURCE_DIR}/cmake
2017-01-26 11:17:02 -05:00
${PROJECT_SOURCE_DIR}/cmake/common
2016-11-02 15:22:45 -04:00
${PROJECT_SOURCE_DIR}/cmake/modules)
include(GNUInstallDirs)
2016-11-02 15:22:45 -04:00
include(utils)
include(01-core)
2017-01-26 11:17:02 -05:00
include(02-opts)
include(04-targets)
2016-06-14 23:32:35 -04:00
if(BUILD_DOC)
add_subdirectory(doc)
endif()
if (BUILD_SHELL)
add_subdirectory(contrib/bash)
add_subdirectory(contrib/zsh)
endif()
2020-12-23 20:02:53 -05:00
# Setup everything that uses a C++ compiler (polybar, polybar-msg, tests)
if(HAS_CXX_COMPILATION)
include(cxx)
if(BUILD_LIBPOLY)
include(libpoly)
add_subdirectory(lib)
endif()
add_subdirectory(include)
add_subdirectory(src bin)
endif()
2016-10-24 19:46:26 -04:00
# We need to enable testing in the root folder so that 'ctest' and 'make test'
# can be run in the build directory
2016-10-12 01:17:03 -04:00
if(BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
2016-10-12 01:17:03 -04:00
endif()
if(BUILD_CONFIG)
install(FILES ${CMAKE_SOURCE_DIR}/doc/config.ini
DESTINATION /etc/${PROJECT_NAME}
COMPONENT config)
endif()
include(05-summary)