Skip to content

Commit 9afa76a

Browse files
author
me
committed
attempt 4
1 parent fa39f4c commit 9afa76a

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

.github/workflows/coverage.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,14 @@ jobs:
4141
- name: Generate coverage report
4242
run: |
4343
llvm-profdata merge -sparse default.profraw -o default.profdata
44-
44+
llvm-cov export -format=lcov -instr-profile default.profdata \
45+
-object ./build/request_parser \
46+
-sources ./src \
47+
> coverage_${{github.sha}}.txt
48+
4549
- name: Upload coverage reports to Codecov
4650
uses: codecov/codecov-action@v5
4751
with:
4852
token: ${{ secrets.CODECOV_TOKEN }}
49-
slug: pfeatherstone/https
53+
slug: pfeatherstone/https
54+
files: coverage_${{github.sha}}.txt

examples/CMakeLists.txt

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
cmake_minimum_required(VERSION 3.13)
22
project(Http)
33

4-
# Helpers
5-
set(IS_CLANG "$<CXX_COMPILER_ID:Clang>")
4+
# Policies
5+
if(POLICY CMP0127)
6+
cmake_policy(SET CMP0127 NEW)
7+
endif()
8+
if(POLICY CMP0135)
9+
cmake_policy(SET CMP0135 OLD)
10+
endif()
611

712
# Deps
813
include(FetchContent)
14+
include(CMakeDependentOption)
915
find_package(Threads REQUIRED)
1016
find_package(OpenSSL REQUIRED)
1117

12-
if(POLICY CMP0135)
13-
cmake_policy(SET CMP0135 OLD)
14-
endif()
1518
set(BOOST_INCLUDE_LIBRARIES compat asio)
1619
set(BOOST_ENABLE_CMAKE ON)
1720
FetchContent_Declare(
@@ -21,14 +24,14 @@ FetchContent_Declare(
2124
FetchContent_MakeAvailable(Boost)
2225

2326
# Options
24-
option(HTTP_BUILD_FUZZERS "Builds Fuzz tests (requires clang)" OFF)
27+
cmake_dependent_option(HTTP_BUILD_FUZZERS "Builds Fuzz tests" OFF "CMAKE_CXX_COMPILER_ID STREQUAL \"Clang\"" OFF)
2528

2629
# Lib
2730
add_library(http ${CMAKE_CURRENT_SOURCE_DIR}/../src/http.cpp)
2831
target_compile_features(http PUBLIC cxx_std_17)
2932
target_include_directories(http PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../src)
3033
target_link_libraries(http PUBLIC OpenSSL::SSL OpenSSL::Crypto Boost::asio)
31-
target_compile_options(http PRIVATE $<$<AND:${IS_CLANG},$<BOOL:${HTTP_BUILD_FUZZERS}>>:-fprofile-instr-generate -fcoverage-mapping>)
34+
target_compile_options(http PRIVATE $<$<BOOL:${HTTP_BUILD_FUZZERS}>:-fprofile-instr-generate -fcoverage-mapping>)
3235

3336
# Examples
3437
function(add_executable_20 target_name)
@@ -64,7 +67,7 @@ target_include_directories(tests PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/extra)
6467
target_link_libraries(tests PRIVATE http)
6568

6669
# Fuzz tests
67-
if (CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND HTTP_BUILD_FUZZERS)
70+
if (HTTP_BUILD_FUZZERS)
6871
function(add_fuzz target_name)
6972
add_executable(${target_name} ${ARGN})
7073
target_link_libraries(${target_name} PRIVATE http)

0 commit comments

Comments
 (0)