-
Notifications
You must be signed in to change notification settings - Fork 22
Expand file tree
/
Copy pathCMakeLists.txt
More file actions
45 lines (37 loc) · 1.23 KB
/
CMakeLists.txt
File metadata and controls
45 lines (37 loc) · 1.23 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
cmake_minimum_required(VERSION 3.21 FATAL_ERROR)
project(InChI C CXX)
option(COVERAGE "Enable coverage reporting" OFF)
if(COVERAGE)
message(STATUS "Building with code coverage enabled")
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
add_compile_options(--coverage -O0 -g)
add_link_options(--coverage)
else()
message(WARNING "Coverage only supported with GCC or Clang")
endif()
endif()
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
include(FetchContent)
FetchContent_Declare(
googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG v1.17.0
)
set(gtest_force_shared_crt ON CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(googletest)
include(CTest)
include(GoogleTest)
enable_testing()
add_subdirectory(INCHI-1-SRC/INCHI_EXE/inchi-1/src)
add_subdirectory(INCHI-1-SRC/INCHI_API/libinchi/src)
add_subdirectory(INCHI-1-TEST/tests/test_unit)
if(COVERAGE)
add_custom_target(coverage
COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure
COMMAND find . -name '*.gcno' -exec gcov -b -c {} +
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
COMMENT "Running tests and generating .gcov coverage reports"
)
endif()