-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
82 lines (64 loc) · 1.75 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
82
# CMake 프로그램의 최소 버전
cmake_minimum_required(VERSION 3.11.0)
# 프로젝트 정보
project(
claujson_cmake_test
VERSION 0.0.1
DESCRIPTION "claujson_cmake_test"
LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 17) # C++17
set(CMAKE_BUILD_TYPE "Release")
set(PROGRAM_NAME claujson_cmake_test)
set(ROOT .)
set(LIB_DIR ${ROOT})
set(SOURCE_DIR ${ROOT})
set(INCLUDE_DIR ${ROOT})
# build setting.
add_executable(${PROGRAM_NAME} ${SOURCE_DIR}/main.cpp)
include(FetchContent)
FetchContent_Declare(
claujson
GIT_REPOSITORY "https://github.com/vztpv/scj3"
GIT_TAG "main"
)
FetchContent_MakeAvailable(claujson)
include(FetchContent)
FetchContent_Declare(
Mimalloc
GIT_REPOSITORY "https://github.com/microsoft/mimalloc"
GIT_TAG "v2.1.7"
)
FetchContent_MakeAvailable(Mimalloc)
# header..
target_include_directories(${PROGRAM_NAME} PRIVATE ${INCLUDE_DIR})
if (UNIX)
target_compile_options(${PROGRAM_NAME} PRIVATE -m64 -std=c++17 -march=native -pthread -Wno-narrowing -O2)
elseif (MSVC)
target_compile_definitions(${PROGRAM_NAME} PRIVATE
"$<$<CONFIG:Release>:"
"NDEBUG"
">"
"_CONSOLE;"
"UNICODE;"
"_UNICODE"
)
if("${CMAKE_VS_PLATFORM_NAME}" STREQUAL "x64")
target_compile_options(${PROGRAM_NAME} PRIVATE
$<$<CONFIG:Release>:
/std:c++17;
/Oi;
/Gy
>
/permissive-;
/sdl;
/W3;
${DEFAULT_CXX_DEBUG_INFORMATION_FORMAT};
${DEFAULT_CXX_EXCEPTION_HANDLING}
)
endif()
endif()
if (UNIX)
target_link_libraries(${PROGRAM_NAME} PRIVATE claujson mimalloc pthread)
elseif (MSVC)
target_link_libraries(${PROGRAM_NAME} PRIVATE claujson mimalloc-static)
endif()