-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
58 lines (48 loc) · 1.59 KB
/
CMakeLists.txt
File metadata and controls
58 lines (48 loc) · 1.59 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
cmake_minimum_required(VERSION 3.28)
project(positionless_cpp)
set(CMAKE_CXX_STANDARD 23)
if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-stdlib=libc++)
add_link_options(-stdlib=libc++)
endif()
# Setup CPM
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v0.40.2/CPM.cmake
${CMAKE_BINARY_DIR}/cmake/CPM.cmake
EXPECTED_HASH SHA256=c8cdc32c03816538ce22781ed72964dc864b2a34a310d3b7104812a5ca2d835d
)
include(${CMAKE_BINARY_DIR}/cmake/CPM.cmake)
# Add doctest
CPMAddPackage(
NAME doctest
GITHUB_REPOSITORY doctest/doctest
VERSION 2.4.12
)
# Add RapidCheck for property-based testing
CPMAddPackage(
NAME rapidcheck
GITHUB_REPOSITORY emil-e/rapidcheck
GIT_TAG master
OPTIONS "RC_ENABLE_TESTS OFF" "RC_ENABLE_EXAMPLES OFF"
)
# Suppress deprecation warnings originating from RapidCheck headers only
if (TARGET rapidcheck)
target_compile_options(rapidcheck INTERFACE
$<$<CXX_COMPILER_ID:Clang,AppleClang,GNU>:-Wno-deprecated-declarations>
)
endif()
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
add_library(positionless INTERFACE)
target_include_directories(positionless INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/include)
target_compile_options(positionless INTERFACE
$<$<CXX_COMPILER_ID:Clang,AppleClang,GNU>:-Wall -Wextra -Wpedantic>
$<$<CXX_COMPILER_ID:MSVC>:/W4>
)
add_executable(unit_tests
test/tests_main.cpp
test/partitioning_tests.cpp
test/algorithms_tests.cpp
)
target_link_libraries(unit_tests PRIVATE positionless doctest::doctest rapidcheck)
enable_testing()
add_test(NAME unit_tests COMMAND unit_tests)