-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
43 lines (30 loc) · 1.06 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
cmake_minimum_required (VERSION 3.0)
project (symmat CXX)
set(SOURCE_NAME "symmat_source")
set(TEST_NAME "symmat_test")
set(PATH_BUILD "${PROJECT_SOURCE_DIR}/build")
set(PATH_INCLUDE "${PROJECT_SOURCE_DIR}/include")
set(PATH_SOURCE "${PROJECT_SOURCE_DIR}/src")
set(PATH_TEST "${PROJECT_SOURCE_DIR}/test")
file(GLOB SOURCES_LIB "${PATH_SOURCE}/*.cpp")
file(GLOB SOURCES_TEST "${PATH_TEST}/*.cpp")
file(GLOB HEADER_FILES "${PATH_INCLUDE}/*.h")
find_package(Eigen3 REQUIRED)
include_directories(${PATH_INCLUDE})
add_library(${SOURCE_NAME} "${SOURCES_LIB}")
target_link_libraries(${SOURCE_NAME} Eigen3::Eigen)
enable_testing()
set(tests
eigen_test
symmat_test
)
list(LENGTH tests temp_len)
math(EXPR test_len "${temp_len} - 1")
foreach(index RANGE ${test_len})
list(GET tests ${index} test)
add_executable(${test} ${PATH_TEST}/${test}.cpp)
target_link_libraries(${test} ${SOURCE_NAME})
add_test(${test} ${test})
endforeach()
add_executable(${PROJECT_NAME} ${PATH_SOURCE}/Main.cpp)
target_link_libraries(${PROJECT_NAME} ${SOURCE_NAME} Eigen3::Eigen)