-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathCMakeLists.txt
74 lines (60 loc) · 1.65 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
cmake_minimum_required(VERSION 3.15)
file(STRINGS "version.txt" project_version)
project(slope LANGUAGES CXX VERSION ${project_version})
option(BUILD_DOCS "Build documentation" OFF)
option(ENABLE_COVERAGE "Generate coverage report" OFF)
include(FetchContent)
include(CTest)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
set(PROJECT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
find_package(Eigen3 3.3 REQUIRED NO_MODULE)
include_directories(${EIGEN3_INCLUDE_DIR})
add_subdirectory(src)
if(BUILD_TESTING)
find_package(Catch2 3 QUIET)
if(NOT Catch2_FOUND)
FetchContent_Declare(
Catch2
GIT_REPOSITORY https://github.com/catchorg/Catch2.git
GIT_TAG v3.4.0
)
FetchContent_MakeAvailable(Catch2)
endif()
add_executable(
tests
tests/gaussian.cpp
tests/prox.cpp
tests/qnorm.cpp
tests/lambda_sequence.cpp
tests/path.cpp
tests/standardize.cpp
tests/sparse.cpp
)
target_link_libraries(
tests
PRIVATE slope Catch2::Catch2WithMain Eigen3::Eigen
)
target_include_directories(tests PUBLIC tests/ "${PROJECT_BINARY_DIR}")
list(APPEND CMAKE_MODULE_PATH ${catch2_SOURCE_DIR}/extras)
include(Catch)
catch_discover_tests(tests)
if(ENABLE_COVERAGE)
find_package(codecov)
add_coverage(tests)
add_coverage(slope)
coverage_evaluate(tests-gcov)
endif()
endif()
if(BUILD_DOCS)
find_package(Doxygen REQUIRED)
set(DOXYGEN_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/docs)
doxygen_add_docs(
docs
${PROJECT_SOURCE_DIR}
docs/
ALL
COMMENT "Generate package documentation"
)
endif()