@@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.10)
22
33set (CODSPEED_VERSION 1.2.0)
44
5- project (codspeed VERSION ${CODSPEED_VERSION} LANGUAGES CXX)
5+ project (codspeed VERSION ${CODSPEED_VERSION} LANGUAGES CXX C )
66
77# Specify the C++ standard
88set (CMAKE_CXX_STANDARD 17)
@@ -11,7 +11,46 @@ set(CMAKE_CXX_STANDARD_REQUIRED True)
1111# Add the include directory
1212include_directories (include )
1313
14- # Add the library
14+ # Add the instrument_hooks library
15+ add_library (
16+ instrument_hooks
17+ STATIC
18+ instrument-hooks/dist/core.c
19+ )
20+
21+ target_include_directories (
22+ instrument_hooks
23+ PUBLIC
24+ $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR} /instrument-hooks/includes>
25+ $<INSTALL_INTERFACE:includes>
26+ )
27+
28+ # Suppress warnings for the instrument_hooks library
29+ if (CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang" )
30+ target_compile_options (
31+ instrument_hooks
32+ PRIVATE
33+ -Wno-maybe-uninitialized
34+ -Wno-unused-variable
35+ -Wno-unused-parameter
36+ -Wno-unused-but-set-variable
37+ -Wno-type -limits
38+ )
39+ elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC" )
40+ target_compile_options (
41+ instrument_hooks
42+ PRIVATE
43+ /wd4101 # unreferenced local variable (equivalent to -Wno-unused-variable)
44+ /wd4189 # local variable is initialized but not referenced (equivalent to -Wno-unused-but-set-variable)
45+ /wd4100 # unreferenced formal parameter (equivalent to -Wno-unused-parameter)
46+ /wd4245 # signed/unsigned mismatch
47+ /wd4132 # const object should be initialized
48+ /wd4146 # unary minus operator applied to unsigned type
49+ )
50+ endif ()
51+
52+
53+ # Add the main library
1554add_library (
1655 codspeed
1756 src/codspeed.cpp
@@ -20,13 +59,17 @@ add_library(
2059 src/workspace.cpp
2160)
2261
62+ # Link instrument_hooks to codspeed
63+ target_link_libraries (codspeed PRIVATE instrument_hooks)
64+
2365# Version
2466add_compile_definitions (CODSPEED_VERSION="${CODSPEED_VERSION} " )
2567
2668# Specify the include directories for users of the library
2769target_include_directories (
2870 codspeed
2971 PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /include >
72+ $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR} /instrument-hooks/includes>
3073)
3174
3275# Disable valgrind compilation errors
@@ -116,7 +159,7 @@ install(
116159)
117160
118161install (
119- TARGETS codspeed
162+ TARGETS codspeed instrument_hooks
120163 EXPORT codspeed-targets
121164 LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
122165 ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
0 commit comments