From cb6c2645c7bb4be0310d47e111a86c783f195dba Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Sat, 1 Aug 2026 19:11:21 +0800 Subject: [PATCH 1/7] [BUILD] Install an explicit list of ext headers instead of the whole tree ext_common installed include/opentelemetry/ext with a *.h glob, so every header under that tree shipped whether or not it was meant to. Naming the headers makes the installed surface deliberate: one reaches the package only when it is listed, which is a signal when a public header is renamed or removed. Three headers the glob installed are dropped. client/detail/default_factory.h is an internal helper included by exporter sources rather than by any public header. client/curl/http_client_curl.h and client/curl/http_operation_curl.h are the curl implementation, and the first includes the second. A consumer creates a curl client through http_client_factory_curl.h, which includes only the abstract http_client_factory.h, so neither is needed to use the package. http_server.h and socket_tools.h stay. examples/http/server.h includes the first, and examples_test builds examples/http against the install prefix whenever ext_http_curl is installed, so removing it breaks examples-build-test. --- CHANGELOG.md | 5 +++++ ext/CMakeLists.txt | 23 ++++++++++++++++++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4183e772c4..cb501d17e8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,11 @@ Increment the: ## [Unreleased] +* [BUILD] Install an explicit list of ext headers instead of the whole + directory. The curl client and curl operation implementation headers and + the internal default factory header are no longer installed + [#4327](https://github.com/open-telemetry/opentelemetry-cpp/pull/4327) + * [BENCHMARK] Add multi-threaded base2 exponential histogram benchmarks [#4319](https://github.com/open-telemetry/opentelemetry-cpp/pull/4319) diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 39a97c4dea..afbdaf1e4d 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -18,6 +18,17 @@ if(WIN32) target_link_libraries(opentelemetry_ext INTERFACE ws2_32) endif() +# The patterns below are the manifest of headers this component installs. They +# replace a "*.h" glob over include/opentelemetry/ext, so a header reaches the +# package only when it is named here, and one that exists for the build tree +# alone stays out of it. +# +# Three headers the glob used to install are deliberately absent. +# client/detail/default_factory.h is an internal helper included by exporter +# sources rather than by any public header. client/curl/http_client_curl.h and +# client/curl/http_operation_curl.h are the curl implementation, and a consumer +# creates a curl client through http_client_factory_curl.h, which depends on the +# abstract http_client_factory.h alone. otel_add_component( COMPONENT ext_common @@ -29,7 +40,17 @@ otel_add_component( "include/opentelemetry" FILES_MATCHING PATTERN - "*.h") + "http_client.h" + PATTERN + "http_client_factory.h" + PATTERN + "http_client_factory_curl.h" + PATTERN + "url_parser.h" + PATTERN + "http_server.h" + PATTERN + "socket_tools.h") add_subdirectory(src) From b54f80f8d65e455d98fed0f544c8d34e07c0f0dc Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Mon, 3 Aug 2026 02:05:33 +0800 Subject: [PATCH 2/7] Keep the embedded server out of the ext package Review feedback on #4327. http_server.h and socket_tools.h are an embedded HTTP server for tests and the http example, so drop them from the ext_common manifest rather than keeping the glob's behaviour for them. The http example includes them, so it cannot build against the install prefix once they stop shipping. Disable it in the install test. That also makes the ws2_32 link on the opentelemetry_ext interface wrong: the target no longer carries a header that calls Winsock, so a package consumer inherits a link it has no use for. Move it to the seven targets that compile the server, which is the full transitive closure of the two headers over the include graph. MSVC autolinks through the pragma in socket_tools.h, so this only shows up on MinGW and GCC for Windows. Bazel's //ext:headers still globs the whole include tree and so still exposes the server, and its linkopt stays for that reason. The file move itself is tracked in #4332. --- CHANGELOG.md | 5 +-- examples/http/CMakeLists.txt | 3 ++ exporters/otlp/CMakeLists.txt | 6 ++++ exporters/zipkin/CMakeLists.txt | 3 ++ ext/CMakeLists.txt | 31 ++++++------------- ext/test/http/CMakeLists.txt | 11 +++++-- .../CMakeLists.txt | 3 ++ .../test/cmake/examples_test/CMakeLists.txt | 6 +++- 8 files changed, 40 insertions(+), 28 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 163ed09660..f1c3aeb8fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,8 +16,9 @@ Increment the: ## [Unreleased] * [BUILD] Install an explicit list of ext headers instead of the whole - directory. The curl client and curl operation implementation headers and - the internal default factory header are no longer installed + directory. The curl client and curl operation implementation headers, the + internal default factory header, and the embedded HTTP server headers + (`http_server.h` and `socket_tools.h`) are no longer installed [#4327](https://github.com/open-telemetry/opentelemetry-cpp/pull/4327) * [BUILD] Run the ext_http component install test on Windows diff --git a/examples/http/CMakeLists.txt b/examples/http/CMakeLists.txt index ffc286354c..d8110b958b 100644 --- a/examples/http/CMakeLists.txt +++ b/examples/http/CMakeLists.txt @@ -14,4 +14,7 @@ if(WITH_HTTP_CLIENT_CURL) http_server PRIVATE opentelemetry-cpp::trace opentelemetry-cpp::http_client_curl opentelemetry-cpp::ostream_span_exporter) + if(WIN32) + target_link_libraries(http_server PRIVATE ws2_32) + endif() endif() diff --git a/exporters/otlp/CMakeLists.txt b/exporters/otlp/CMakeLists.txt index 7720528407..35d7f3a79f 100644 --- a/exporters/otlp/CMakeLists.txt +++ b/exporters/otlp/CMakeLists.txt @@ -1013,6 +1013,9 @@ if(BUILD_TESTING) nlohmann_json::nlohmann_json protobuf::libprotobuf opentelemetry_test_common) + if(WIN32) + target_link_libraries(otlp_http_exporter_test ws2_32) + endif() gtest_add_tests( TARGET otlp_http_exporter_test TEST_PREFIX exporter.otlp. @@ -1040,6 +1043,9 @@ if(BUILD_TESTING) opentelemetry_http_client_nosend nlohmann_json::nlohmann_json opentelemetry_test_common) + if(WIN32) + target_link_libraries(otlp_http_log_record_exporter_test ws2_32) + endif() gtest_add_tests( TARGET otlp_http_log_record_exporter_test TEST_PREFIX exporter.otlp. diff --git a/exporters/zipkin/CMakeLists.txt b/exporters/zipkin/CMakeLists.txt index b90b1177ce..46fbecb1c1 100644 --- a/exporters/zipkin/CMakeLists.txt +++ b/exporters/zipkin/CMakeLists.txt @@ -74,6 +74,9 @@ if(BUILD_TESTING) opentelemetry_resources opentelemetry_http_client_nosend CURL::libcurl) + if(WIN32) + target_link_libraries(zipkin_exporter_test ws2_32) + endif() gtest_add_tests( TARGET zipkin_exporter_test diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index afbdaf1e4d..49ef73d1bd 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -10,25 +10,16 @@ target_include_directories( set_target_properties(opentelemetry_ext PROPERTIES EXPORT_NAME "ext") target_link_libraries(opentelemetry_ext INTERFACE opentelemetry_api) -# The embedded HTTP server headers (socket_tools.h) call Winsock, so declare the -# dependency on the interface target. MSVC also autolinks via #pragma -# comment(lib), but MinGW/GCC ignore that, so consumers there would otherwise -# fail to resolve inet_pton/WSAStartup. -if(WIN32) - target_link_libraries(opentelemetry_ext INTERFACE ws2_32) -endif() - -# The patterns below are the manifest of headers this component installs. They -# replace a "*.h" glob over include/opentelemetry/ext, so a header reaches the -# package only when it is named here, and one that exists for the build tree -# alone stays out of it. -# -# Three headers the glob used to install are deliberately absent. # client/detail/default_factory.h is an internal helper included by exporter # sources rather than by any public header. client/curl/http_client_curl.h and -# client/curl/http_operation_curl.h are the curl implementation, and a consumer -# creates a curl client through http_client_factory_curl.h, which depends on the -# abstract http_client_factory.h alone. +# client/curl/http_operation_curl.h are the curl implementation, reached through +# http_client_factory_curl.h, which depends on the abstract +# http_client_factory.h alone. server/http_server.h and server/socket_tools.h +# are the embedded server used by tests and the http example. +# +# TODO: the embedded server headers do not belong beside the user facing ones +# under ext/include. Move them to an internal location such as test_common, see +# #4332. otel_add_component( COMPONENT ext_common @@ -46,11 +37,7 @@ otel_add_component( PATTERN "http_client_factory_curl.h" PATTERN - "url_parser.h" - PATTERN - "http_server.h" - PATTERN - "socket_tools.h") + "url_parser.h") add_subdirectory(src) diff --git a/ext/test/http/CMakeLists.txt b/ext/test/http/CMakeLists.txt index 14d6aee613..fcf95c4d33 100644 --- a/ext/test/http/CMakeLists.txt +++ b/ext/test/http/CMakeLists.txt @@ -8,6 +8,9 @@ if(WITH_HTTP_CLIENT_CURL) ${FILENAME} PRIVATE ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES} opentelemetry_http_client_curl opentelemetry_common CURL::libcurl) + if(WIN32) + target_link_libraries(${FILENAME} PRIVATE ws2_32) + endif() gtest_add_tests( TARGET ${FILENAME} TEST_PREFIX ext.http.curl. @@ -18,9 +21,11 @@ set(SOCKET_TOOLS_FILENAME socket_tools_test) add_executable(${SOCKET_TOOLS_FILENAME} ${SOCKET_TOOLS_FILENAME}.cc) target_link_libraries(${SOCKET_TOOLS_FILENAME} opentelemetry_ext ${GMOCK_LIB} ${GTEST_BOTH_LIBRARIES} ${CMAKE_THREAD_LIBS_INIT}) -# ws2_32 is now an interface dependency of opentelemetry_ext, so it is inherited -# here; the test thus verifies the public target's usage requirements rather -# than papering over them locally. +# socket_tools.h calls Winsock, and the ext interface target no longer carries +# that link because it is only needed where the embedded server is compiled. +if(WIN32) + target_link_libraries(${SOCKET_TOOLS_FILENAME} ws2_32) +endif() gtest_add_tests( TARGET ${SOCKET_TOOLS_FILENAME} TEST_PREFIX ext.http.sockettools. diff --git a/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt b/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt index 064b186037..24cd3b6099 100644 --- a/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt +++ b/ext/test/w3c_tracecontext_http_test_server/CMakeLists.txt @@ -8,4 +8,7 @@ if(WITH_HTTP_CLIENT_CURL) PRIVATE ${CMAKE_THREAD_LIBS_INIT} opentelemetry_trace opentelemetry_http_client_curl opentelemetry_exporter_ostream_span CURL::libcurl nlohmann_json::nlohmann_json) + if(WIN32) + target_link_libraries(w3c_tracecontext_http_test_server PRIVATE ws2_32) + endif() endif() diff --git a/install/test/cmake/examples_test/CMakeLists.txt b/install/test/cmake/examples_test/CMakeLists.txt index 798a9124f2..b6a9025bb5 100644 --- a/install/test/cmake/examples_test/CMakeLists.txt +++ b/install/test/cmake/examples_test/CMakeLists.txt @@ -47,10 +47,14 @@ if("exporters_etw" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) endif() if("ext_http_curl" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) - set(WITH_EXAMPLES_HTTP ON) set(WITH_HTTP_CLIENT_CURL ON) endif() +# The http example uses the embedded server headers, which the package no longer +# installs. The ext headers it does use are covered by +# install/test/src/test_ext_*.cc. +set(WITH_EXAMPLES_HTTP OFF) + if("configuration" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) set(WITH_CONFIGURATION ON) endif() From 6ade65d06ffd3cd6475c929f3ff9461343e805cc Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Mon, 3 Aug 2026 05:30:43 +0800 Subject: [PATCH 3/7] Call the removed headers out as a breaking change Per review: the entry described the removals in prose and named only two of the five headers. It now sits under Breaking changes with every path listed, and says what a consumer that included one of them should do instead. --- CHANGELOG.md | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index f1c3aeb8fd..011a030c81 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,12 +15,6 @@ Increment the: ## [Unreleased] -* [BUILD] Install an explicit list of ext headers instead of the whole - directory. The curl client and curl operation implementation headers, the - internal default factory header, and the embedded HTTP server headers - (`http_server.h` and `socket_tools.h`) are no longer installed - [#4327](https://github.com/open-telemetry/opentelemetry-cpp/pull/4327) - * [BUILD] Run the ext_http component install test on Windows [#4326](https://github.com/open-telemetry/opentelemetry-cpp/pull/4326) @@ -97,6 +91,23 @@ Increment the: Breaking changes: +* [BUILD] Install an explicit list of ext headers instead of the whole + directory + [#4327](https://github.com/open-telemetry/opentelemetry-cpp/pull/4327) + * The `ext_common` component installed `include/opentelemetry/ext` with a + `*.h` glob. It now installs a named list, and these five headers are no + longer part of the package: + * `opentelemetry/ext/http/client/curl/http_client_curl.h` + * `opentelemetry/ext/http/client/curl/http_operation_curl.h` + * `opentelemetry/ext/http/client/detail/default_factory.h` + * `opentelemetry/ext/http/server/http_server.h` + * `opentelemetry/ext/http/server/socket_tools.h` + * Code that included any of them from an installed package will no longer + compile. A curl client is created through `http_client_factory_curl.h`, + which needs only the abstract `http_client_factory.h`. The two server + headers are an embedded test server; moving them out of `ext` is tracked + in #4332. + * [METRICS SDK] Rename Base2 Exponential Histogram Aggregation config field [#4253](https://github.com/open-telemetry/opentelemetry-cpp/pull/4253) * The public configuration member `max_buckets_` was renamed to `max_size_` to From ed6f6d776f8bdb8865595cda015f299ec933dfec Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Mon, 3 Aug 2026 05:39:26 +0800 Subject: [PATCH 4/7] Fail the install test if an internal ext header ships Every other case here compiles against headers that are present, so putting the glob back over include/opentelemetry/ext would leave all of them passing while the package quietly grew five headers again. The check runs against the include directory the installed api target points at, not the test project's own prefix. --- install/test/cmake/CMakeLists.txt | 35 +++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/install/test/cmake/CMakeLists.txt b/install/test/cmake/CMakeLists.txt index dfe569bf8f..6133069b33 100644 --- a/install/test/cmake/CMakeLists.txt +++ b/install/test/cmake/CMakeLists.txt @@ -46,6 +46,41 @@ endif() message(STATUS "INSTALL_TEST_COMPONENTS = ${INSTALL_TEST_COMPONENTS}") +# The ext_common component installs a named list of headers rather than a glob +# over include/opentelemetry/ext. Every other test here compiles against headers +# that are present, so putting the glob back would leave them all passing. These +# are the headers the component is meant to leave out, checked against the +# prefix that was actually installed. +if("ext_common" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) + get_target_property(OTEL_API_INCLUDE_DIRS opentelemetry-cpp::api + INTERFACE_INCLUDE_DIRECTORIES) + list(GET OTEL_API_INCLUDE_DIRS 0 OTEL_INSTALLED_INCLUDE_DIR) + message( + STATUS + "Checking ${OTEL_INSTALLED_INCLUDE_DIR} for headers that must not ship") + + set(OTEL_EXT_HEADERS_NOT_INSTALLED + "opentelemetry/ext/http/client/curl/http_client_curl.h" + "opentelemetry/ext/http/client/curl/http_operation_curl.h" + "opentelemetry/ext/http/client/detail/default_factory.h" + "opentelemetry/ext/http/server/http_server.h" + "opentelemetry/ext/http/server/socket_tools.h") + + set(OTEL_UNEXPECTED_HEADERS "") + foreach(header ${OTEL_EXT_HEADERS_NOT_INSTALLED}) + if(EXISTS "${OTEL_INSTALLED_INCLUDE_DIR}/${header}") + list(APPEND OTEL_UNEXPECTED_HEADERS ${header}) + endif() + endforeach() + + if(OTEL_UNEXPECTED_HEADERS) + message( + FATAL_ERROR + "The ext_common component installed headers it is meant to leave out: ${OTEL_UNEXPECTED_HEADERS}" + ) + endif() +endif() + set(INSTALL_TEST_SRC_DIR "${CMAKE_SOURCE_DIR}/../src") enable_testing() From 9e187675b91c374bc6efdcf27f91a060130327d3 Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Mon, 3 Aug 2026 06:35:38 +0800 Subject: [PATCH 5/7] Make the header check fail loudly rather than look in nowhere get_target_property returns -NOTFOUND when the property is unset, and list(GET) returns that string without complaint, so every EXISTS below would answer false and the check would pass having examined nothing. It now insists on a real directory first. Also drop the WITH_HTTP_CLIENT_CURL block from examples_test: the only thing under examples/ that reads it is examples/http, which this PR no longer builds there. --- install/test/cmake/CMakeLists.txt | 11 +++++++++++ install/test/cmake/examples_test/CMakeLists.txt | 4 ---- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/install/test/cmake/CMakeLists.txt b/install/test/cmake/CMakeLists.txt index 6133069b33..8cf5d5664e 100644 --- a/install/test/cmake/CMakeLists.txt +++ b/install/test/cmake/CMakeLists.txt @@ -55,6 +55,17 @@ if("ext_common" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) get_target_property(OTEL_API_INCLUDE_DIRS opentelemetry-cpp::api INTERFACE_INCLUDE_DIRECTORIES) list(GET OTEL_API_INCLUDE_DIRS 0 OTEL_INSTALLED_INCLUDE_DIR) + + # A check whose only job is to fail loudly must not pass by looking in + # nowhere. An unset property yields -NOTFOUND, which list(GET) returns + # happily and every EXISTS below would then answer false. + if(NOT IS_DIRECTORY "${OTEL_INSTALLED_INCLUDE_DIR}") + message( + FATAL_ERROR + "Cannot find the installed include directory to check, got '${OTEL_INSTALLED_INCLUDE_DIR}'" + ) + endif() + message( STATUS "Checking ${OTEL_INSTALLED_INCLUDE_DIR} for headers that must not ship") diff --git a/install/test/cmake/examples_test/CMakeLists.txt b/install/test/cmake/examples_test/CMakeLists.txt index b6a9025bb5..30bd94bfe9 100644 --- a/install/test/cmake/examples_test/CMakeLists.txt +++ b/install/test/cmake/examples_test/CMakeLists.txt @@ -46,10 +46,6 @@ if("exporters_etw" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) set(WITH_ETW ON) endif() -if("ext_http_curl" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) - set(WITH_HTTP_CLIENT_CURL ON) -endif() - # The http example uses the embedded server headers, which the package no longer # installs. The ext headers it does use are covered by # install/test/src/test_ext_*.cc. From a75c0e531cc43e8b2761bf98138cba2d1fa0e175 Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Mon, 3 Aug 2026 07:13:11 +0800 Subject: [PATCH 6/7] Prune the excluded directories so neither ships empty install(DIRECTORY) creates a destination directory for every source directory it walks and applies FILES_MATCHING to the files it finds there, so listing only file names left include/opentelemetry/ext/http/ server and .../client/detail installed with nothing in them. Excluding the two directories drops them from the walk, and the install test now asserts they are absent rather than relying on the file check alone. --- ext/CMakeLists.txt | 13 ++++++++++++- install/test/cmake/CMakeLists.txt | 19 +++++++++++++++++++ 2 files changed, 31 insertions(+), 1 deletion(-) diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt index 49ef73d1bd..db7fbaf1d5 100644 --- a/ext/CMakeLists.txt +++ b/ext/CMakeLists.txt @@ -17,6 +17,11 @@ target_link_libraries(opentelemetry_ext INTERFACE opentelemetry_api) # http_client_factory.h alone. server/http_server.h and server/socket_tools.h # are the embedded server used by tests and the http example. # +# The two directory excludes are what keeps client/detail and server out of the +# install tree entirely: install(DIRECTORY) creates a destination directory for +# every source directory it walks, so filtering on file names alone would leave +# both behind, empty. +# # TODO: the embedded server headers do not belong beside the user facing ones # under ext/include. Move them to an internal location such as test_common, see # #4332. @@ -37,7 +42,13 @@ otel_add_component( PATTERN "http_client_factory_curl.h" PATTERN - "url_parser.h") + "url_parser.h" + PATTERN + "detail" + EXCLUDE + PATTERN + "server" + EXCLUDE) add_subdirectory(src) diff --git a/install/test/cmake/CMakeLists.txt b/install/test/cmake/CMakeLists.txt index 8cf5d5664e..65e65c10b4 100644 --- a/install/test/cmake/CMakeLists.txt +++ b/install/test/cmake/CMakeLists.txt @@ -90,6 +90,25 @@ if("ext_common" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) "The ext_common component installed headers it is meant to leave out: ${OTEL_UNEXPECTED_HEADERS}" ) endif() + + # Excluding only file names would still create these two directories, empty, + # because install(DIRECTORY) walks the source tree before it filters. + set(OTEL_EXT_DIRS_NOT_INSTALLED "opentelemetry/ext/http/client/detail" + "opentelemetry/ext/http/server") + + set(OTEL_UNEXPECTED_DIRS "") + foreach(dir ${OTEL_EXT_DIRS_NOT_INSTALLED}) + if(IS_DIRECTORY "${OTEL_INSTALLED_INCLUDE_DIR}/${dir}") + list(APPEND OTEL_UNEXPECTED_DIRS ${dir}) + endif() + endforeach() + + if(OTEL_UNEXPECTED_DIRS) + message( + FATAL_ERROR + "The ext_common component left directories behind in the install tree: ${OTEL_UNEXPECTED_DIRS}" + ) + endif() endif() set(INSTALL_TEST_SRC_DIR "${CMAKE_SOURCE_DIR}/../src") From 528cb1ca64bc8962d7372091fb71ee04d6177144 Mon Sep 17 00:00:00 2001 From: thc1006 <84045975+thc1006@users.noreply.github.com> Date: Mon, 3 Aug 2026 23:55:58 +0800 Subject: [PATCH 7/7] Drop the install check for headers that must not ship A list of files that should not exist has no natural end, and every entry is one more thing to keep in step with the install rules. The removal these five headers needed is already shown by the install test compiling against the package without them, and by this PR's CI run. Signed-off-by: thc1006 <84045975+thc1006@users.noreply.github.com> --- install/test/cmake/CMakeLists.txt | 65 ------------------------------- 1 file changed, 65 deletions(-) diff --git a/install/test/cmake/CMakeLists.txt b/install/test/cmake/CMakeLists.txt index 65e65c10b4..dfe569bf8f 100644 --- a/install/test/cmake/CMakeLists.txt +++ b/install/test/cmake/CMakeLists.txt @@ -46,71 +46,6 @@ endif() message(STATUS "INSTALL_TEST_COMPONENTS = ${INSTALL_TEST_COMPONENTS}") -# The ext_common component installs a named list of headers rather than a glob -# over include/opentelemetry/ext. Every other test here compiles against headers -# that are present, so putting the glob back would leave them all passing. These -# are the headers the component is meant to leave out, checked against the -# prefix that was actually installed. -if("ext_common" IN_LIST OPENTELEMETRY_CPP_COMPONENTS_INSTALLED) - get_target_property(OTEL_API_INCLUDE_DIRS opentelemetry-cpp::api - INTERFACE_INCLUDE_DIRECTORIES) - list(GET OTEL_API_INCLUDE_DIRS 0 OTEL_INSTALLED_INCLUDE_DIR) - - # A check whose only job is to fail loudly must not pass by looking in - # nowhere. An unset property yields -NOTFOUND, which list(GET) returns - # happily and every EXISTS below would then answer false. - if(NOT IS_DIRECTORY "${OTEL_INSTALLED_INCLUDE_DIR}") - message( - FATAL_ERROR - "Cannot find the installed include directory to check, got '${OTEL_INSTALLED_INCLUDE_DIR}'" - ) - endif() - - message( - STATUS - "Checking ${OTEL_INSTALLED_INCLUDE_DIR} for headers that must not ship") - - set(OTEL_EXT_HEADERS_NOT_INSTALLED - "opentelemetry/ext/http/client/curl/http_client_curl.h" - "opentelemetry/ext/http/client/curl/http_operation_curl.h" - "opentelemetry/ext/http/client/detail/default_factory.h" - "opentelemetry/ext/http/server/http_server.h" - "opentelemetry/ext/http/server/socket_tools.h") - - set(OTEL_UNEXPECTED_HEADERS "") - foreach(header ${OTEL_EXT_HEADERS_NOT_INSTALLED}) - if(EXISTS "${OTEL_INSTALLED_INCLUDE_DIR}/${header}") - list(APPEND OTEL_UNEXPECTED_HEADERS ${header}) - endif() - endforeach() - - if(OTEL_UNEXPECTED_HEADERS) - message( - FATAL_ERROR - "The ext_common component installed headers it is meant to leave out: ${OTEL_UNEXPECTED_HEADERS}" - ) - endif() - - # Excluding only file names would still create these two directories, empty, - # because install(DIRECTORY) walks the source tree before it filters. - set(OTEL_EXT_DIRS_NOT_INSTALLED "opentelemetry/ext/http/client/detail" - "opentelemetry/ext/http/server") - - set(OTEL_UNEXPECTED_DIRS "") - foreach(dir ${OTEL_EXT_DIRS_NOT_INSTALLED}) - if(IS_DIRECTORY "${OTEL_INSTALLED_INCLUDE_DIR}/${dir}") - list(APPEND OTEL_UNEXPECTED_DIRS ${dir}) - endif() - endforeach() - - if(OTEL_UNEXPECTED_DIRS) - message( - FATAL_ERROR - "The ext_common component left directories behind in the install tree: ${OTEL_UNEXPECTED_DIRS}" - ) - endif() -endif() - set(INSTALL_TEST_SRC_DIR "${CMAKE_SOURCE_DIR}/../src") enable_testing()