From 77e1fb3a475acff79b25663843c1fa91547ff48a Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Thu, 22 May 2025 14:04:26 -0700 Subject: [PATCH 1/2] [BUILD] Error out when building DLL without MSVC --- CHANGELOG.md | 3 +++ ext/src/CMakeLists.txt | 2 +- ext/src/dll/CMakeLists.txt | 6 ++++++ 3 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a6f91d0b50..070a7acf09 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,9 @@ Increment the: ## [Unreleased] +* [BUILD] Error out when building DLL without MSVC + [#3438] (https://github.com/open-telemetry/opentelemetry-cpp/pull/3438) + * [Metrics SDK] Use nostd::function_ref in AttributesHashMap [#3393](https://github.com/open-telemetry/opentelemetry-cpp/pull/3393) diff --git a/ext/src/CMakeLists.txt b/ext/src/CMakeLists.txt index 65aaa307c0..b3d45a719d 100644 --- a/ext/src/CMakeLists.txt +++ b/ext/src/CMakeLists.txt @@ -5,6 +5,6 @@ if(WITH_HTTP_CLIENT_CURL) add_subdirectory(http/client/curl) endif() -if(MSVC AND DEFINED OPENTELEMETRY_BUILD_DLL) +if(DEFINED OPENTELEMETRY_BUILD_DLL) add_subdirectory(dll) endif() diff --git a/ext/src/dll/CMakeLists.txt b/ext/src/dll/CMakeLists.txt index 4eb953b154..7cdb1e9ce2 100644 --- a/ext/src/dll/CMakeLists.txt +++ b/ext/src/dll/CMakeLists.txt @@ -1,6 +1,12 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 +if (NOT MSVC) + message( + FATAL_ERROR + "The OpenTelemetry C++ SDK for Windows DLL is only supported on MSVC.") +endif() + set(OPENTELEMETRY_EXPORT_DEF "${CMAKE_CURRENT_BINARY_DIR}/opentelemetry_cpp.def") From 83cb23419c48a73ace769445a73cb22655c59b26 Mon Sep 17 00:00:00 2001 From: Tom Tan Date: Thu, 22 May 2025 14:17:42 -0700 Subject: [PATCH 2/2] Fix format --- CHANGELOG.md | 2 +- ext/src/dll/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 070a7acf09..489a314255 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ Increment the: ## [Unreleased] * [BUILD] Error out when building DLL without MSVC - [#3438] (https://github.com/open-telemetry/opentelemetry-cpp/pull/3438) + [#3438](https://github.com/open-telemetry/opentelemetry-cpp/pull/3438) * [Metrics SDK] Use nostd::function_ref in AttributesHashMap [#3393](https://github.com/open-telemetry/opentelemetry-cpp/pull/3393) diff --git a/ext/src/dll/CMakeLists.txt b/ext/src/dll/CMakeLists.txt index 7cdb1e9ce2..d5c273c83a 100644 --- a/ext/src/dll/CMakeLists.txt +++ b/ext/src/dll/CMakeLists.txt @@ -1,7 +1,7 @@ # Copyright The OpenTelemetry Authors # SPDX-License-Identifier: Apache-2.0 -if (NOT MSVC) +if(NOT MSVC) message( FATAL_ERROR "The OpenTelemetry C++ SDK for Windows DLL is only supported on MSVC.")