-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
88 lines (70 loc) · 3.21 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
cmake_minimum_required(VERSION 3.15)
#! Check every comment after the "#!"
#! CHANGE YOUR PROJECT NAME
# It is used as your project's main executable name.
set(PROJECT_NAME test_task)
project(${PROJECT_NAME} C CXX) # project(${PROJECT_NAME} C CXX ASM)
set(CMAKE_CXX_STANDARD 23)
##########################################################
# User configurable options of the template
##########################################################
# Note: symbols like WARNINGS_AS_ERRORS in configuration are intentionally variables
# and not CMake options --using options creates too many problems for students.
#! It is a good practice to set "WARNINGS_AS_ERRORS" ON,
# but sometimes it creates too much trouble, so default is OFF.
set(WARNINGS_AS_ERRORS OFF)
#! Always use PVS Studio while developing.
set(ENABLE_PVS_STUDIO OFF)
#! Select appropriate sanitizers.
# Definitely enable sanitizers while developing.
# Disable it for the production builds and before submitting for grading.
# Only one of the Memory (MSAN), Address (ASAN), or Thread (TSan)
# sanitizers is applicable at the time -- the first defined.
#! UndefinedBehaviorSanitizer (UBSan).
# Info: https://clang.llvm.org/docs/UndefinedBehaviorSanitizer.html
set(ENABLE_UBSan OFF)
#! AddressSanitizer -- detects use after free or after scope exit,
# memory overflows and leaks.
# Info: https://github.com/google/sanitizers/wiki/AddressSanitizer
set(ENABLE_ASAN OFF)
#! ThreadSanitizer -- detects data races.
# Info: https://clang.llvm.org/docs/ThreadSanitizer.html
set(ENABLE_TSan OFF)
#! MemorySanitizer -- detects uninitialized memory reads
# Info: https://github.com/google/sanitizers/wiki/MemorySanitizer
set(ENABLE_MSAN OFF)
#! Be default -- build release version if not specified otherwise.
if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif ()
# Warnings as errors should be imported here -- do not move this line
include(cmake/CompilerWarnings.cmake)
##########################################################
# Project files, packages, libraries and so on
##########################################################
#! Project main executable source compilation
add_executable(${PROJECT_NAME} main.cpp utils.cpp utils.h)
#! Add external packages
find_package(PkgConfig REQUIRED)
pkg_check_modules(gtk3 REQUIRED IMPORTED_TARGET gtk+-3.0)
pkg_search_module(gstreamer REQUIRED IMPORTED_TARGET gstreamer-1.0>=1.4)
pkg_search_module(gstreamer-sdp REQUIRED IMPORTED_TARGET gstreamer-sdp-1.0>=1.4)
pkg_search_module(gstreamer-app REQUIRED IMPORTED_TARGET gstreamer-app-1.0>=1.4)
pkg_search_module(gstreamer-video REQUIRED IMPORTED_TARGET gstreamer-video-1.0>=1.4)
target_link_libraries(${PROJECT_NAME}
PkgConfig::gtk3
PkgConfig::gstreamer
PkgConfig::gstreamer-sdp
PkgConfig::gstreamer-app
PkgConfig::gstreamer-video
)
##########################################################
# Fixed CMakeLists.txt part
##########################################################
INSTALL(PROGRAMS
$<TARGET_FILE:${PROJECT_NAME}> # ${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}
DESTINATION bin)
# Define ALL_TARGETS variable to use in PVS and Sanitizers
set(ALL_TARGETS ${PROJECT_NAME})
# Include CMake setup
include(cmake/main-config.cmake)