This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
63 lines (42 loc) · 2.37 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
cmake_minimum_required(VERSION 3.16)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
set(CMAKE_COLOR_DIAGNOSTICS ON)
set(CMAKE_CXX_FLAGS_DEBUG "-Og")
set(CMAKE_CXX_FLAGS_RELEASE "-O3")
set(IGNORE_Qt TRUE)
get_filename_component(OUTPUT_NAME ${CMAKE_CURRENT_SOURCE_DIR} NAME)
project(${OUTPUT_NAME} VERSION 0.1 LANGUAGES CXX)
#------------------------------------------------------------------------------------------------------
# - DEFINE THE LIST OF THE SOURCES (CURRENT TARGET) BELOW IN VARIABLE SCAN_SOURCES_FOLDER
# - ATTACH EXTERNAL LIBRARIES AT THE BOTTOM OF THAT FILE
list(APPEND SCAN_SOURCES_FOLDER "src")
#------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------
include(CMakeLists.txt_z_Utils.cmake)
#------------------------------------------------------------------------------------------------------
include(CMakeLists.txt_z_Utils_Qt.cmake) # Add Qt application
if(NOT QT_APP_ADDED)
add_executable(${OUTPUT_NAME} ${${PROJECT_NAME}_SOURCES}) # Add application
endif()
include(CMakeLists.txt_z_Utils_SafetyFlags.cmake)
target_compile_options(${OUTPUT_NAME} PRIVATE ${SAFETY_FLAGS}) # Compiler's safety flags
include(CMakeLists.txt_z_Utils_VCRuntime.cmake) # Add VCRuntime libs if needed
include(CMakeLists.txt_z_Utils_Boost.cmake) # Add Boost if it possible
#------------------------------------------------------------------------------------------------------
target_include_directories(${OUTPUT_NAME} PUBLIC ${${PROJECT_NAME}_INCLUDES})
#------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------
# ATTACH EXTERNAL LIBRARIES
set(EXT_LIBS_FILE "${PROJECT_SOURCE_DIR}/CMakeLists.txt_a_Project_Libs.cmake")
if(EXISTS "${EXT_LIBS_FILE}")
include("${EXT_LIBS_FILE}")
endif()
#------------------------------------------------------------------------------------------------------
#------------------------------------------------------------------------------------------------------
# ADD TESTS
set(EXT_LIBS_FILE "${PROJECT_SOURCE_DIR}/CMakeLists.txt_b_Project_Tests.cmake")
if(EXISTS "${EXT_LIBS_FILE}")
include("${EXT_LIBS_FILE}")
endif()