-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
69 lines (59 loc) · 1.81 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
cmake_minimum_required(VERSION 3.20)
project("nc-tools" VERSION "3.1.0" LANGUAGES CXX)
if(${PROJECT_SOURCE_DIR} EQUAL ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "Don't be a fool, out-of-source build with your tool.")
endif()
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
option(NC_TOOLS_BUILD_CONVERTER "Build nc-convert executable" ON)
option(NC_TOOLS_BUILD_TESTS "Include tests in build" ON)
option(NC_TOOLS_STATIC_ANALYSIS "Enable static analysis (MSVC Only)" OFF)
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
set(NC_TOOLS_COMPILE_OPTIONS
-Werror
-Wall
-Wextra
-Wpedantic
-Wshadow
-Wconversion
-Wfatal-errors
-Wno-cast-function-type
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "CLANG" OR CMAKE_CXX_COMPILER_ID STREQUAL "APPLECLANG")
set(NC_TOOLS_COMPILE_OPTIONS
-Wall
-Wextra
-Wpedantic
-Wshadow
-Wconversion
)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
set(NC_TOOLS_COMPILE_OPTIONS
/W4
/WX
/MP
)
if(${NC_TOOLS_STATIC_ANALYSIS})
set(NC_TOOLS_COMPILE_OPTIONS
${NC_TOOLS_COMPILE_OPTIONS}
/analyze
/analyze:external-
/external:W0
/external:I${PROJECT_BINARY_DIR}/_deps
/external:I${PROJECT_SOURCE_DIR}/source/external
/wd6326 # Suppress 'potential comparison of constants'
)
endif()
endif()
add_definitions(-DNC_ASSERT_ENABLED)
include(FetchContent)
FetchContent_Declare(NcCommon
GIT_REPOSITORY https://github.com/NcStudios/NcCommon.git
GIT_TAG v1.1.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(NcCommon)
add_subdirectory(source)
if(NC_TOOLS_BUILD_TESTS)
add_subdirectory(test)
endif()