-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
32 lines (23 loc) · 952 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
29
30
31
32
CMAKE_MINIMUM_REQUIRED(VERSION 3.8)
project(Euler3D LANGUAGES CXX VERSION "0.1.0")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# add_compile_options_config(<CONFIG> <option> ...)
function(add_compile_options_config CONFIG)
foreach(opt ${ARGN})
add_compile_options("$<$<CONFIG:${CONFIG}>:${opt}>")
endforeach()
endfunction()
# Add static analysis tool and sanitizers when needed ( "-fanalyzer", "-fsanitize=leak" ...)
# add_link_options(-fsanitize=leak,undefined,address)
#add_link_options(-flto)
# --- Add same flag to compile options ----
add_compile_options_config(RELEASE "-Wall" "-Wextra" "-Ofast" "-pedantic")
add_compile_options_config(DEBUG "-Wall" "-Wextra" "-g3" "-pedantic")
add_compile_options_config(RELWITHDEBINFO "-Wall" "-Wextra" "-Ofast" "-pedantic" "-g3")
ADD_SUBDIRECTORY(src)
#include tests
option(PACKAGE_TESTS "Build the tests" OFF)
IF(PACKAGE_TESTS)
ADD_SUBDIRECTORY(test)
ENDIF()