-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
28 lines (22 loc) · 868 Bytes
/
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
cmake_minimum_required(VERSION 3.2)
if(ASAN_BUILD)
set(ENV{CC} clang)
set(ENV{CXX} clang++)
message(STATUS "Using clang toolchain")
endif()
project(tinyjson)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(ASAN_BUILD)
# build with ASAN for our all of our targets
message(STATUS "Enabling ASAN checks")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -O0")
set(CMAKE_LINKER_FLAGS_DEBUG "${CMAKE_LINKER_FLAGS_DEBUG} -fno-omit-frame-pointer -fsanitize=address -O0")
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS 1)
set(TEST_SRCS "${CMAKE_CURRENT_LIST_DIR}/main.cpp")
set(LIB_SRCS "${CMAKE_CURRENT_LIST_DIR}/tinyjson.cpp")
add_executable(tinytest "${TEST_SRCS}")
target_link_libraries(tinytest tinyjson)
add_library(tinyjson STATIC "${LIB_SRCS}")