Skip to content

Commit f022dda

Browse files
committed
Update makeTests.cmake
1 parent 96fbcf7 commit f022dda

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

cmake/makeTests.cmake

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,20 @@
11
add_main_dependencies()
22

3+
if(CONNECTION_MACHINE_CODE_COVERAGE)
4+
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
5+
message(STATUS "Code coverage enabled")
6+
add_compile_options(--coverage -O0 -g)
7+
add_link_options(--coverage)
8+
elseif(MSVC)
9+
message(WARNING "Code coverage does nothing with MSVC. Use normal Tests build, and use opencpp_coverage.cmd")
10+
else()
11+
message(WARNING "Code coverage not working with: \"${CMAKE_CXX_COMPILER_ID}\"")
12+
endif()
13+
else()
14+
message(WARNING "Code coverage cant not be used without also enabling tests.")
15+
endif()
16+
17+
318
# Google Testing
419

520
CPMAddPackage(
@@ -35,18 +50,3 @@ target_link_libraries(${PROJECT_NAME}_tests PRIVATE ${EXTERNAL_LINKS})
3550

3651
target_precompile_headers(${PROJECT_NAME}_tests PRIVATE "${SOURCE_DIR}/precompiled.h")
3752

38-
if(CONNECTION_MACHINE_CODE_COVERAGE)
39-
if (CONNECTION_MACHINE_BUILD_TESTS)
40-
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
41-
message(STATUS "Code coverage enabled")
42-
add_compile_options(--coverage -O0 -g)
43-
add_link_options(--coverage)
44-
elseif(MSVC)
45-
message(WARNING "Code coverage does nothing with MSVC. Use normal Tests build, and use opencpp_coverage.cmd")
46-
else()
47-
message(WARNING "Code coverage not working with: \"${CMAKE_CXX_COMPILER_ID}\"")
48-
endif()
49-
else()
50-
message(WARNING "Code coverage cant not be used without also enabling tests.")
51-
endif()
52-
endif()

0 commit comments

Comments
 (0)