-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
40 lines (34 loc) · 1.26 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
cmake_minimum_required(VERSION 3.19)
project(cube-timer LANGUAGES CXX VERSION 1.3.1)
# C++ standard
set(CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_STANDARD 17)
# Sets the default build mode on Release
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "RELEASE" CACHE STRING "" FORCE)
endif()
# Warnings for Debug mode
#set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -g -Wall -Wextra -Wpedantic -Wshadow -Wpointer-arith -Wcast-qual -Wno-missing-braces -Wswitch-default -Wcast-align -Wunreachable-code -Wuninitialized")
# Speed optimization for Release mode
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Os")
# Useful pre-compile definitions
if(CMAKE_BUILD_TYPE MATCHES "Debug")
add_compile_definitions(DEBUG_MODE)
endif()
if(CMAKE_BUILD_TYPE MATCHES "Release")
add_compile_definitions(RELEASE_MODE)
endif()
add_compile_definitions(PROJECT_VERSION="${PROJECT_VERSION}")
add_compile_definitions(GLOBAL_PATH="${CMAKE_SOURCE_DIR}")
# Qt5 import
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
set(QT_VERSION 5)
set(REQUIRED_LIBS Core Gui Widgets)
set(REQUIRED_LIBS_QUALIFIED Qt5::Core Qt5::Gui Qt5::Widgets)
find_package(Qt${QT_VERSION} COMPONENTS ${REQUIRED_LIBS} REQUIRED)
# Adding subdirectories
add_subdirectory(src)
enable_testing()
add_subdirectory(test)