-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
54 lines (42 loc) · 1.26 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
cmake_minimum_required(VERSION 3.24)
project(
cpp_algorithms
LANGUAGES C CXX
VERSION 1.0.0
DESCRIPTION "Template project for code implemented in C and C++."
)
find_library(MATH_LIBRARY m)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include_directories(include)
add_subdirectory(arrays)
add_subdirectory(problems)
cmake_policy(SET CMP0054 NEW)
cmake_policy(SET CMP0057 NEW)
## Check for some required header files
include(CheckIncludeFile)
include(CheckSymbolExists)
check_include_file(stdbool.h HAS_STDBOOL_H)
check_include_file(inttypes.h HAS_INTTYPES_H)
check_include_file(complex.h HAS_COMPLEX_H)
if (HAS_COMPLEX_H)
check_symbol_exists(complex complex.h HAS_COMPLEX_TYPE)
endif (HAS_COMPLEX_H)
if (NOT HAS_STDBOOL_H)
message(FATAL_ERROR "Missing required header: 'stdbool.h'")
endif ()
if (NOT HAS_INTTYPES_H)
message(FATAL_ERROR "Missing required header: 'inttypes.h'")
endif ()
set(CPACK_PROJECT_NAME ${PROJECT_NAME})
set(CPACK_PROJECT_VERSION ${PROJECT_VERSION})
include(CPack)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.12.x
)
FetchContent_MakeAvailable(googletest)
enable_testing()
add_subdirectory(tests)