File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed
Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -14,19 +14,21 @@ set(CMAKE_VERBOSE_MAKEFILE ON)
1414
1515option (WITH_TESTING "Whether to enable tests" ON )
1616option (WITH_EXAMPLES "Whether to enable examples" ON )
17+ option (WITH_MPH "Whether to use mph" ON )
1718option (INSTALL_RESOURCE_DETECTORS "Whether to install Resource Detectors" ON )
1819
19- include (FetchContent)
20-
2120find_package (opentelemetry-cpp CONFIG REQUIRED)
2221
23- FetchContent_Declare(
24- qlibs_mph
25- GIT_REPOSITORY https://github.com/qlibs/mph
26- GIT_TAG v5.0.4
27- )
22+ if (WITH_MPH)
23+ include (FetchContent)
24+ FetchContent_Declare(
25+ qlibs_mph
26+ GIT_REPOSITORY https://github.com/qlibs/mph
27+ GIT_TAG v5.0.4
28+ )
2829
29- FetchContent_MakeAvailable(qlibs_mph)
30+ FetchContent_MakeAvailable(qlibs_mph)
31+ endif ()
3032
3133add_library (utils OBJECT)
3234target_sources (
@@ -38,13 +40,14 @@ target_sources(
3840 src/string_utils.cpp
3941)
4042
41- target_link_libraries (
42- utils
43- PUBLIC opentelemetry-cpp::resources
44- PRIVATE qlibs_mph
45- )
43+ target_link_libraries (utils PUBLIC opentelemetry-cpp::resources)
4644
47- target_include_directories (utils PUBLIC ${qlibs_mph_SOURCE_DIR} )
45+ if (WITH_MPH)
46+ target_link_libraries (utils PRIVATE qlibs_mph)
47+ target_include_directories (utils PUBLIC ${qlibs_mph_SOURCE_DIR} )
48+ else ()
49+ target_compile_definitions (utils PRIVATE DISABLE_MPH)
50+ endif ()
4851
4952add_library (helpers STATIC $<TARGET_OBJECTS:utils>)
5053target_include_directories (helpers PUBLIC ${CMAKE_SOURCE_DIR} /src)
Original file line number Diff line number Diff line change 33#include < string_view>
44#include < utility>
55
6- #if (defined(__clang__) && __clang_major__ < 15) || (defined(__GNUC__) && __GNUC__ < 12) || defined(__MINGW32__)
6+ #if !defined(DISABLE_MPH) && \
7+ ((defined (__clang__) && __clang_major__ < 15 ) || (defined (__GNUC__) && __GNUC__ < 12 ) || defined (__MINGW32__))
78# define DISABLE_MPH
89#endif
910
You can’t perform that action at this time.
0 commit comments