-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
94 lines (74 loc) · 4.09 KB
/
CMakeLists.txt
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
cmake_minimum_required(VERSION 3.24 FATAL_ERROR)
set(CMAKE_FIND_NO_INSTALL_PREFIX TRUE)
project(meazure_linux
VERSION 5.0.0.10
DESCRIPTION "A tool for easily measuring and capturing portions of the screen."
HOMEPAGE_URL "https://github.com/cthing/meazure-linux")
if(NOT CMAKE_HOST_SYSTEM_NAME MATCHES "Linux")
message(FATAL_ERROR "Meazure only builds on Linux")
endif()
set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/install CACHE PATH "Meazure development install directory" FORCE)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_CLEAN_FILES ${CMAKE_INSTALL_PREFIX})
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
string(TIMESTAMP BUILD_DATE "%B %m %Y")
set(APP_DIR "${PROJECT_SOURCE_DIR}/meazure")
set(TEST_DIR "${PROJECT_SOURCE_DIR}/test")
set(DEV_DIR "${PROJECT_SOURCE_DIR}/dev")
include(${DEV_DIR}/conan/cthing-conan.cmake)
conan_cmake_configure(REQUIRES
qt/6.4.2
libffi/3.4.3 # Resolve Qt conflict between wayland and glib
expat/2.5.0 # Resolve Qt conflict between wayland and frontconfig
xerces-c/3.2.4
OPTIONS qt:shared=False qt:qtsvg=True qt:qttools=True qt:qtwayland=True harfbuzz:with_glib=False xerces-c:char_type=char16_t
GENERATORS ${CTHING_CONAN_GENERATOR})
CTHING_CONAN_INSTALL()
find_package(Qt6 COMPONENTS Core Gui Widgets Svg Network Test REQUIRED)
find_package(ICU COMPONENTS uc REQUIRED)
find_package(XercesC REQUIRED)
find_package(Doxygen REQUIRED)
find_program(CMAKE_LINT_PROGRAM "cmake-lint" REQUIRED)
qt_standard_project_setup()
enable_testing()
set(CMAKE_COMPILE_WARNING_AS_ERROR TRUE)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wno-comment")
set(CMAKE_CXX_CLANG_TIDY clang-tidy-15)
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
message(STATUS "Output directory: ${CMAKE_BINARY_DIR}")
file(GLOB_RECURSE BUILD_FILES CMakeLists.txt)
add_custom_target(cmakelint
COMMAND ${CMAKE_LINT_PROGRAM} ${BUILD_FILES} --config ${DEV_DIR}/cmake-lint/config.py
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR})
add_custom_target(apidocs
COMMAND ${CMAKE_COMMAND} -E rm -rf "${CMAKE_CURRENT_BINARY_DIR}/meazure/apidocs"
COMMAND ${CMAKE_COMMAND} -E env MEA_APIDOCS_DIR=${CMAKE_CURRENT_BINARY_DIR}/meazure/apidocs ${DOXYGEN_EXECUTABLE} "${DEV_DIR}/doxygen/meazure.cfg"
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR})
add_custom_target(project_package
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target package
USES_TERMINAL)
add_custom_target(project_test
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target all test
USES_TERMINAL)
add_custom_target(project_full_build
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target cmakelint
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target all
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target test
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target apidocs
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target project_package
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target package_sha256
COMMAND ${CMAKE_COMMAND} --build ${PROJECT_BINARY_DIR} --target lintian
USES_TERMINAL)
add_subdirectory(meazure)
add_subdirectory(test)
# Files generated by MOC, RCC, and UIC may produce clang-tidy warnings. Generate a dummy .clang-tidy file in the
# binary directory that disables all clang-tidy checks except one that will never match. This one check is needed
# because clang-tidy reports an error if no checks are enabled. Since the Qt code generators will generate source
# files in the binary tree, clang-tidy will load the configuration from this dummy file when the sources are built.
file(WRITE "${CMAKE_BINARY_DIR}/.clang-tidy" "
---
InheritParentConfig: false
Checks: '-*,llvm-twine-local'
...
")