-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
86 lines (69 loc) · 2.01 KB
/
CMakeLists.txt
File metadata and controls
86 lines (69 loc) · 2.01 KB
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
75
76
77
78
79
80
81
82
83
84
85
cmake_minimum_required(VERSION 3.28.0)
project(MiniParserVisualizer VERSION 0.1.0 LANGUAGES CXX)
message(STATUS "Version ${PROJECT_NAME}: ${PROJECT_VERSION}")
set(CMAKE_CXX_STANDARD 23)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_compile_options(
-Wall
-Wpedantic
-Wconversion
)
include_directories(${CMAKE_SOURCE_DIR}/src)
# GTest
find_package(GTest REQUIRED)
if(NOT GTest_FOUND)
message(STATUS "GTest not found. Trying to download...")
include(FetchContent)
FetchContent_Declare(
googletest
URL https://github.com/google/googletest/archive/refs/tags/v1.14.0.tar.gz
)
FetchContent_MakeAvailable(googletest)
find_package(GTest REQUIRED)
if(GTest_FOUND)
message(STATUS "GTest downloaded and found ^_^. Version: ${GTest_VERSION}")
else()
message(FATAL_ERROR "GTest not found after download")
endif()
else()
message(STATUS "GTest found ^_^. Version: ${GTest_VERSION}")
endif()
# nlohmann/json
include(FetchContent)
FetchContent_Declare(
nlohmann_json
URL https://github.com/nlohmann/json/releases/download/v3.12.0/json.tar.xz
)
FetchContent_MakeAvailable(nlohmann_json)
include_directories(${nlohmann_json_SOURCE_DIR}/include)
message(STATUS "nlohmann_json downloaded and included ^_^.")
# My libraries
add_library(Parser STATIC
src/Parser.cpp
)
target_link_libraries(Parser PRIVATE nlohmann_json::nlohmann_json)
# Executable for data
add_executable(data_generator src/Generator.cpp)
# Main executable
add_executable(${PROJECT_NAME} src/main.cpp)
target_link_libraries(${PROJECT_NAME} PRIVATE Parser)
# Install targets
install(TARGETS ${PROJECT_NAME} DESTINATION bin)
# Scripts
install(PROGRAMS
scripts/plot.py
scripts/run_pipeline.sh
DESTINATION bin
)
# Docs
install(FILES
README.md
build_my_project.sh
DESTINATION .
)
# Tests
include(CTest)
enable_testing()
add_executable(testParser tests/ParserTests.cpp)
target_link_libraries(testParser PRIVATE Parser GTest::GTest GTest::Main)
add_test(NAME ParserTests COMMAND testParser)