-
Notifications
You must be signed in to change notification settings - Fork 2
/
CMakeLists.txt
34 lines (25 loc) · 1.11 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
cmake_minimum_required(VERSION 3.12)
project(libintelhex VERSION 1.0
DESCRIPTION "Intel hex C++ parsing library"
LANGUAGES CXX)
# Prepare "Catch" library for other executables
set(CATCH_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdparty/catch)
add_library(Catch2::Catch IMPORTED INTERFACE)
target_include_directories(Catch2::Catch INTERFACE ${CATCH_INCLUDE_DIR})
add_compile_definitions(TEST_ENABLE_FILE_OPS)
add_library(intelhex src/intelhex.cpp)
target_compile_features(intelhex PUBLIC cxx_std_17)
target_include_directories(intelhex PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/src)
set(TESTS_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}/tests)
set(TESTS_SOURCE ${TESTS_SOURCE_DIR}/main.cpp
${TESTS_SOURCE_DIR}/tests.cpp
${TESTS_SOURCE_DIR}/../src/intelhex.cpp)
add_executable(tests ${TESTS_SOURCE})
target_link_libraries(tests Catch2::Catch intelhex)
if (ENABLE_COVERAGE)
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/CMake")
find_package(codecov)
add_coverage(tests)
list(APPEND LCOV_REMOVE_PATTERNS "/usr/")
coverage_evaluate()
endif()