-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
40 lines (25 loc) · 1.07 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
cmake_minimum_required(VERSION 3.15)
project(mite)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
add_compile_options(-Wall)
set(SRC_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(HEADER_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/include)
file(GLOB_RECURSE SRC ${SRC_ROOT}/*.cpp)
file(GLOB_RECURSE HEADERS ${HEADER_ROOT}/*.hpp)
set(INCLUDE_DIRS ${HEADER_ROOT})
add_executable(mite ${SRC} ${HEADERS})
target_include_directories(mite PRIVATE ${INCLUDE_DIRS})
if(CMAKE_BUILD_TYPE STREQUAL "debug")
target_compile_options(mite PRIVATE -Og -ggdb3 -DDEBUG)
elseif(CMAKE_BUILD_TYPE STREQUAL "release")
target_compile_options(mite PRIVATE -O2 -flto=thin)
elseif(CMAKE_BUILD_TYPE STREQUAL "windows")
target_compile_options(mite PRIVATE -DWINDOWS -DNO_LSP)
endif()
# nlohmann json
FetchContent_Declare(json URL https://github.com/nlohmann/json/archive/refs/tags/v3.11.0.tar.gz)
FetchContent_MakeAvailable(json)
target_link_libraries(mite PRIVATE ${LIB} nlohmann_json::nlohmann_json)
add_custom_target(format COMMAND clang-format -i ${SRC} ${HEADERS})