-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
37 lines (29 loc) · 1.03 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
cmake_minimum_required(VERSION 3.15)
project(example)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS FALSE)
add_compile_options(
-pedantic-errors
-Wno-unused-parameter
"$<$<CONFIG:DEBUG>:-Og>" "$<$<CONFIG:DEBUG>:-g3>"
"$<$<CONFIG:RELEASE>:-O3>" "$<$<CONFIG:RELEASE>:-g3>"
-Wall -Werror -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free
-pthread
)
set(DEPS_DEPLOY_DIR ${CMAKE_BINARY_DIR}/_deps)
include_directories ("${PROJECT_SOURCE_DIR}")
include("FetchContent")
FetchContent_Declare(
spdlog
GIT_REPOSITORY https://github.com/gabime/spdlog.git
GIT_TAG v1.4.2
)
FetchContent_MakeAvailable(spdlog)
link_libraries(pthread)
file(GLOB_RECURSE mains RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}" "${CMAKE_CURRENT_SOURCE_DIR}/example/*.cpp")
foreach(mainfile IN LISTS mains)
get_filename_component(mainname ${mainfile} NAME_WE)
add_executable(${mainname} ${mainfile})
target_include_directories(${mainname} PUBLIC ${DEPS_DEPLOY_DIR}/spdlog-src/include/)
target_link_libraries(spdlog)
endforeach()