-
Notifications
You must be signed in to change notification settings - Fork 4
/
CMakeLists.txt
47 lines (38 loc) · 1.32 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
cmake_minimum_required (VERSION 3.16)
project(FastString VERSION 1.0)
set(CMAKE_CPP_COMPILER g++)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED YES)
set(CMAKE_CXX_EXTENSIONS NO)
set(CMAKE_VERBOSE_MAKEFILE ON)
# lots of warnings and all warnings as errors
message("setting CMAKE_CXX_FLAGS")
set(CMAKE_BUILD_TYPE Release)
if (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
message("setting MSVC CMAKE_CXX_FLAGS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Ox")
add_compile_options(/wd2220)
#add_compile_definitions(FastString_DISABLE_IOSTREAM)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
message("setting GCC CMAKE_CXX_FLAGS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
message("setting Clang CMAKE_CXX_FLAGS")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -stdlib=libc++")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++20")
else()
message("setting ${CMAKE_CXX_COMPILER_ID} CMAKE_CXX_FLAGS")
endif()
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
include(GoogleTest)
enable_testing()
add_subdirectory(example)
add_subdirectory(benchmark)
add_subdirectory(test)