-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
59 lines (46 loc) · 1.25 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
cmake_minimum_required(VERSION 3.10)
project(CLAVIS LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
# Set build type (default is Debug)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# Basic compiler flags
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra")
endif()
# Collect source files
file(GLOB CORE_SOURCES
src/*.cpp
src/graph/*.hpp
src/data_structure/*.hpp
src/sorting/*.hpp
)
# Collect test files
file(GLOB TEST_SOURCES
tests/*.cpp
tests/graph/*.cpp
tests/data_structure/*.cpp
tests/sorting/*.cpp
)
# Combine all sources
set(SOURCES ${CORE_SOURCES})
# Create library
add_library(clavis_algorithm ${SOURCES})
# Set include directories
target_include_directories(clavis_algorithm PUBLIC
${CMAKE_SOURCE_DIR}/src
)
# Google Test configuration
find_package(GTest REQUIRED)
enable_testing()
# Test executable
add_executable(clavis_algorithm_test ${TEST_SOURCES})
# Set include directories for tests
target_include_directories(clavis_algorithm_test PRIVATE
${CMAKE_SOURCE_DIR}/src
)
target_link_libraries(clavis_algorithm_test clavis_algorithm GTest::GTest GTest::Main)
# Register test
add_test(NAME AlgorithmTest COMMAND clavis_algorithm_test)