-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathCMakeLists.txt
56 lines (50 loc) · 1.31 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
cmake_minimum_required(VERSION 3.22)
project(CNOTE LANGUAGES CXX)
## ============================================================================
## Global vars
## ============================================================================
set(CMAKE_CXX_STANDARD 20)
## ============================================================================
## CCache
## ============================================================================
# Use `ccache` if it is installed in system's PATH.
find_program(CCACHE_PROGRAM ccache)
if(CCACHE_PROGRAM)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_PROGRAM}")
endif()
# Export compilation database in JSON format.
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
## ============================================================================
## CNOTE
## ============================================================================
add_library (
CNOTE_LIB
lib/cnote/cnote.cpp
inc/cnote/cnote.h
)
target_include_directories (
CNOTE_LIB
PUBLIC
inc
)
add_executable (
CNOTE
src/main.cpp
)
target_include_directories (
CNOTE
PRIVATE
inc
)
target_link_libraries (
CNOTE
CNOTE_LIB
)
add_dependencies (
CNOTE
CNOTE_LIB
)
target_compile_options(CNOTE PRIVATE
$<$<CXX_COMPILER_ID:MSVC>:/W4 /WX>
$<$<NOT:$<CXX_COMPILER_ID:MSVC>>:-Wall -Wextra -Wpedantic -Werror>
)