-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
71 lines (54 loc) · 1.67 KB
/
CMakeLists.txt
File metadata and controls
71 lines (54 loc) · 1.67 KB
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
cmake_minimum_required(VERSION 3.19)
find_program(GCC_COMPILER gcc)
if(GCC_COMPILER)
message(STATUS "GCC found: ${GCC_COMPILER}")
set(CMAKE_C_COMPILER "gcc")
set(CMAKE_CXX_COMPILER "g++")
else()
message(STATUS "GCC not found, falling back to Clang")
set(CMAKE_C_COMPILER "clang")
set(CMAKE_CXX_COMPILER "clang++")
endif()
add_compile_options(-O2 -O3)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
add_compile_options(-Wthread-safety)
endif()
project(LongMath)
include(FetchContent)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.12.1
)
FetchContent_MakeAvailable(googletest)
FetchContent_Declare(
benchmark
GIT_REPOSITORY https://github.com/google/benchmark.git
GIT_TAG v1.7.1
)
FetchContent_MakeAvailable(benchmark)
if(TARGET benchmark)
target_compile_options(benchmark INTERFACE -Wno-unused-but-set-variable)
endif()
FetchContent_Declare(
gflags
GIT_REPOSITORY https://github.com/gflags/gflags.git
GIT_TAG v2.2.2
)
FetchContent_MakeAvailable(gflags)
add_executable(main main.cpp)
include_directories(LongNum)
add_subdirectory(LongNum)
target_link_libraries(main LongNum benchmark::benchmark)
enable_testing()
add_executable(pitest PiTest.cpp)
target_link_libraries(pitest benchmark::benchmark)
target_link_libraries(pitest LongNum)
target_link_libraries(pitest gtest gtest_main)
target_link_libraries(pitest gflags::gflags)
add_executable(mathtest MathTest.cpp)
target_link_libraries(mathtest LongNum)
target_link_libraries(mathtest gtest gtest_main)