-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
36 lines (26 loc) · 796 Bytes
/
Copy pathCMakeLists.txt
File metadata and controls
36 lines (26 loc) · 796 Bytes
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
cmake_minimum_required(VERSION 3.10)
project(microgradCpp VERSION 1.0 LANGUAGES CXX)
# Set C++ standard
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
include_directories(${PROJECT_SOURCE_DIR}/include /usr/local/include)
add_executable(main main.cpp)
find_package(GTest REQUIRED)
file(GLOB TEST_SOURCES tests/test*.cpp)
add_executable(test_output ${TEST_SOURCES})
target_link_libraries(test_output GTest::GTest GTest::Main pthread)
add_custom_target(run
COMMAND ./main
DEPENDS main
COMMENT "Running the main executable"
)
add_custom_target(test_run
COMMAND ./test_output
DEPENDS test_output
COMMENT "Running the tests"
)
# Clean target
add_custom_target(clean_all
COMMAND rm -f main test_output
COMMENT "Cleaning up build artifacts"
)