-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
70 lines (60 loc) · 2.19 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
cmake_minimum_required(VERSION 3.14)
project(dotmake)
include(FetchContent)
FetchContent_Declare(
yaml-cpp
GIT_REPOSITORY https://github.com/jbeder/yaml-cpp/
GIT_TAG yaml-cpp-0.7.0
)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest
GIT_TAG 15460959cbbfa20e66ef0b5ab497367e47fc0a04
)
FetchContent_Declare(
googlebenchmark
GIT_REPOSITORY https://github.com/google/benchmark
GIT_TAG d572f4777349d43653b21d6c2fc63020ab326db2
)
if (WIN32)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
endif ()
FetchContent_MakeAvailable(yaml-cpp googletest googlebenchmark)
set(DotmakeLib ${PROJECT_NAME}lib)
add_library(${DotmakeLib} src/system_caller.cpp
src/link_task.cpp
src/shell_task.cpp
src/specification.cpp
src/task.cpp
src/yaml_parser.cpp
)
set_property(TARGET ${DotmakeLib} PROPERTY CXX_STANDARD 17)
target_link_libraries(${DotmakeLib} PUBLIC yaml-cpp)
target_include_directories(${DotmakeLib} PUBLIC ${CMAKE_SOURCE_DIR}/include)
if (WIN32)
add_executable(${PROJECT_NAME} src/main.cpp libs/getopt/getopt.c)
target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_SOURCE_DIR}/libs/getopt)
else()
add_executable(${PROJECT_NAME} src/main.cpp)
endif ()
set_property(TARGET ${PROJECT_NAME} PROPERTY CXX_STANDARD 17)
target_link_libraries(${PROJECT_NAME} PRIVATE ${DotmakeLib})
# Benchmarking
set(BenchmarkingProject ${CMAKE_PROJECT_NAME}_benchmark)
add_executable(${BenchmarkingProject}
benchmark/shell_task_parser_benchmark.cpp
benchmark/link_task_parser_benchmark.cpp
)
set_property(TARGET ${BenchmarkingProject} PROPERTY CXX_STANDARD 17)
target_link_libraries(${BenchmarkingProject} ${DotmakeLib} benchmark::benchmark benchmark::benchmark_main)
# Testing
enable_testing()
set(TestProject ${PROJECT_NAME}_test)
add_executable(${TestProject}
test/shell_task_parser_test.cpp
test/link_task_parser_test.cpp
)
set_property(TARGET ${TestProject} PROPERTY CXX_STANDARD 17)
target_link_libraries(${TestProject} ${DotmakeLib} GTest::gtest_main GTest::gmock)
include(GoogleTest)
gtest_discover_tests(${TestProject})