Skip to content

Commit 7e397c3

Browse files
committed
fix: build warnings for instrument-hooks
1 parent 48e91c3 commit 7e397c3

File tree

2 files changed

+21
-9
lines changed

2 files changed

+21
-9
lines changed

core/CMakeLists.txt

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,33 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
1212
include_directories(include)
1313
include_directories(instrument-hooks/includes)
1414

15-
# Add the library
15+
# Create separate instrument_hooks library with warning suppressions
16+
add_library(
17+
instrument_hooks
18+
instrument-hooks/dist/core.c
19+
)
20+
21+
# Suppress warnings for the instrument_hooks library
22+
target_compile_options(
23+
instrument_hooks
24+
PRIVATE
25+
-Wno-unused-variable
26+
-Wno-unused-parameter
27+
-Wno-unused-but-set-variable
28+
-Wno-type-limits
29+
)
30+
31+
# Add the main library
1632
add_library(
1733
codspeed
1834
src/codspeed.cpp
1935
src/walltime.cpp
2036
src/uri.cpp
2137
src/workspace.cpp
22-
instrument-hooks/dist/core.c
2338
)
2439

25-
# Suppress warnings only for instrument-hooks/dist/core.c
26-
set_source_files_properties(
27-
instrument-hooks/dist/core.c
28-
PROPERTIES COMPILE_FLAGS "-Wno-unused-variable -Wno-unused-parameter"
29-
)
40+
# Link instrument_hooks to codspeed
41+
target_link_libraries(codspeed PRIVATE instrument_hooks)
3042

3143
# Version
3244
add_compile_definitions(CODSPEED_VERSION="${CODSPEED_VERSION}")
@@ -125,7 +137,7 @@ install(
125137
)
126138

127139
install(
128-
TARGETS codspeed
140+
TARGETS codspeed instrument_hooks
129141
EXPORT codspeed-targets
130142
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
131143
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}

google_benchmark/src/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ set(project_config "${generated_dir}/${PROJECT_NAME}Config.cmake")
9292
set(pkg_config "${generated_dir}/${PROJECT_NAME}.pc")
9393
set(pkg_config_main "${generated_dir}/${PROJECT_NAME}_main.pc")
9494
# TODO: Find a way to not expose codspeed headers to downstream users
95-
set(targets_to_export benchmark benchmark_main codspeed)
95+
set(targets_to_export benchmark benchmark_main codspeed instrument_hooks)
9696
set(targets_export_name "${PROJECT_NAME}Targets")
9797

9898
set(namespace "${PROJECT_NAME}::")

0 commit comments

Comments
 (0)