-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
81 lines (64 loc) · 1.92 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
cmake_minimum_required(VERSION 3.23)
project(locc VERSION "0.4.0")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_DEBUG_POSTFIX "-d")
set(not_top_level ON)
if(${PROJECT_IS_TOP_LEVEL})
set(not_top_level OFF)
endif()
set(FETCHCONTENT_QUIET ${not_top_level})
option(LOCC_BUILD_CLI "Build locc CLI app" ${PROJECT_IS_TOP_LEVEL})
option(LOCC_BUILD_GUI "Build locc GUI app" ${PROJECT_IS_TOP_LEVEL})
option(LOCC_BUILD_TESTS "Build locc tests" ${PROJECT_IS_TOP_LEVEL})
add_library(${PROJECT_NAME}-compile-options INTERFACE)
add_library(${PROJECT_NAME}::${PROJECT_NAME}-compile-options ALIAS ${PROJECT_NAME}-compile-options)
if(CMAKE_CXX_COMPILER_ID STREQUAL Clang OR CMAKE_CXX_COMPILER_ID STREQUAL GNU)
target_compile_options(${PROJECT_NAME}-compile-options INTERFACE
-Wall -Wextra -Wpedantic -Wconversion -Werror=return-type
)
endif()
include(FetchContent)
set(ext_dir "${CMAKE_CURRENT_SOURCE_DIR}/ext")
set(fetch_targets "")
if(LOCC_BUILD_GUI AND NOT TARGET gvdi)
FetchContent_Declare(gvdi
GIT_REPOSITORY https://github.com/karnkaul/gvdi
GIT_TAG v0.2.3
GIT_SHALLOW TRUE
SOURCE_DIR "${ext_dir}/src/gvdi"
)
list(APPEND fetch_targets gvdi)
endif()
if(NOT TARGET djson)
FetchContent_Declare(djson
GIT_REPOSITORY https://github.com/karnkaul/djson
GIT_TAG v2.1.2
GIT_SHALLOW TRUE
SOURCE_DIR "${ext_dir}/src/djson"
)
list(APPEND fetch_targets djson)
endif()
if(NOT TARGET klib)
set(KLIB_BUILD_TESTS ON)
FetchContent_Declare(klib
GIT_REPOSITORY https://github.com/karnkaul/klib
GIT_TAG v0.1.3
GIT_SHALLOW TRUE
SOURCE_DIR "${ext_dir}/src/klib"
)
list(APPEND fetch_targets klib)
endif()
FetchContent_MakeAvailable(${fetch_targets})
add_subdirectory(lib)
if(LOCC_BUILD_CLI)
add_subdirectory(cli)
endif()
if(LOCC_BUILD_GUI)
add_subdirectory(gui)
endif()
if(LOCC_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()