Skip to content

Commit a105afb

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

File tree

2 files changed

+22
-9
lines changed

2 files changed

+22
-9
lines changed

core/CMakeLists.txt

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,34 @@ 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-maybe-uninitialized
26+
-Wno-unused-variable
27+
-Wno-unused-parameter
28+
-Wno-unused-but-set-variable
29+
-Wno-type-limits
30+
)
31+
32+
# Add the main library
1633
add_library(
1734
codspeed
1835
src/codspeed.cpp
1936
src/walltime.cpp
2037
src/uri.cpp
2138
src/workspace.cpp
22-
instrument-hooks/dist/core.c
2339
)
2440

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-
)
41+
# Link instrument_hooks to codspeed
42+
target_link_libraries(codspeed PRIVATE instrument_hooks)
3043

3144
# Version
3245
add_compile_definitions(CODSPEED_VERSION="${CODSPEED_VERSION}")
@@ -125,7 +138,7 @@ install(
125138
)
126139

127140
install(
128-
TARGETS codspeed
141+
TARGETS codspeed instrument_hooks
129142
EXPORT codspeed-targets
130143
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
131144
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)