Repository: conan-io/conan-center-index

Issue:
[package] opentelemetry-cpp/1.9.1: fails to build due to broken opentelemetry-proto dependency 
### Description

run `conan install . --build=missing` with a conanfile:

```
[requires]
opentelemetry-cpp/1.9.1

[generators]
cmake

```
The package installation fails with message:
```
'ERROR: opentelemetry-cpp/1.9.1: required component package 'opentelemetry-proto::' not in dependencies'
The output is observed after 
'opentelemetry-cpp/1.9.1: Package '8865730c41263c8e8733581b5e0ae10b5378ffa9' created' 
```

### Package and Environment Details

* Package Name/Version: **opentelemetry-cpp/1.9.1**
* Operating System+version: **Linux Ubuntu 22.04**


### Conan profile

[settings]
arch=x86_64
build_type=Release
compiler=gcc
compiler.cppstd=gnu17
compiler.libcxx=libstdc++11
compiler.version=13
os=Linux



### Steps to reproduce

create conanfile as:

[requires]
opentelemetry-cpp/1.9.1

[generators]
cmake
run conan install . --build=missing

### Logs

<details><summary>Click to expand log</summary>

```
ERROR: opentelemetry-cpp/1.9.1: required component package 'opentelemetry-proto::' not in dependencies
```

</details>
Note: the cmake build passes successfully, and the package seems to be installed, just that this dependency check makes it unusable.
opentelemetry-cpp: fix visibility of protobuf and gRPC headers
Protobuf and gRPC headers must be made available for consumers of the OpenTelemetry package because the generated headers for OTLP refer to them.

This fixes the following compiler errors downstream:

```
In file included from $HOME/.conan2/p/b/opent272c3e9f1254c/p/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h:11:
In file included from $HOME/.conan2/p/b/opent272c3e9f1254c/p/include/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h:22:
$HOME/.conan2/p/b/opent272c3e9f1254c/p/include/opentelemetry/proto/collector/trace/v1/trace_service.pb.h:10:10: fatal error: 'google/protobuf/port_def.inc' file not found
```

```
In file included from $HOME/.conan2/p/b/opentde6f16d8c2837/p/include/opentelemetry/exporters/otlp/otlp_grpc_exporter.h:11:
$HOME/.conan2/p/b/opentde6f16d8c2837/p/include/opentelemetry/proto/collector/trace/v1/trace_service.grpc.pb.h:25:10: fatal error: 'grpcpp/generic/async_generic_service.h' file not found
```

---

- [x] I've read the [contributing guidelines](https://github.com/conan-io/conan-center-index/blob/master/CONTRIBUTING.md).
- [x] I've used a [recent](https://github.com/conan-io/conan/releases/latest) Conan client version close to the [currently deployed](https://github.com/conan-io/conan-center-index/blob/master/.c3i/config_v1.yml#L6).
- [x] I've tried at least one configuration locally with the [conan-center hook](https://github.com/conan-io/hooks.git) activated.



Discussion:
@dfszb are you aware of a workaround?
I have the same issue. Same goes for version 1.8.1 as well.

As far as I can see the recipe is broken as target "opentelemetry-proto::opentelemetry-proto" does not exist. I'm playing around with some ugly patching until this is solved.

@sebsnyk Maybe you are doing the same? But currently I'm starting with downloading opentelemetry-cpp/1.9.1, then removing the "opentelemetry-proto::opentelemetry-proto" line and then the "conan install" as usual. I can of course share the ugly bash code if you like 😃 
I detected other pull requests that are modifying opentelemetry-cpp/all recipe:
- #18647

This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there.

@RubenRBS 

> Edit: I see v2 is failing with: `ERROR: opentelemetry-cpp/1.3.0: required component package 'opentelemetry-proto::' not in dependencies`

That's fixed by https://github.com/conan-io/conan-center-index/pull/19759 🙂 
### Conan v1 pipeline :heavy_check_mark:

All green in build 1 (`a29e07940aa3ed676d1c8b2df5f52b6dcf29502c`):

 * **opentelemetry-cpp/1.9.1:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.9.1//summary.json))

 * **opentelemetry-cpp/1.2.0:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.2.0//summary.json))

 * **opentelemetry-cpp/1.7.0:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.7.0//summary.json))

 * **opentelemetry-cpp/1.6.1:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.6.1//summary.json))

 * **opentelemetry-cpp/1.4.1:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.4.1//summary.json))

 * **opentelemetry-cpp/1.0.1:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.0.1//summary.json))

 * **opentelemetry-cpp/1.3.0:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.3.0//summary.json))

 * **opentelemetry-cpp/1.8.1:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.8.1//summary.json))

 * **opentelemetry-cpp/1.4.0:**
   All packages built successfully! ([All logs](https://c3i.jfrog.io/c3i/misc/summary.html?json=https://c3i.jfrog.io/c3i/misc/logs/pr/19793/1/opentelemetry-cpp/1.4.0//summary.json))

----------

### Conan v2 pipeline :x:

> **Regression**: Conan v2 builds are mandatory and they are required for the PR to be merged, because this recipe worked with Conan v2 previously.

The v2 pipeline failed. Please, review the errors and note this is required for pull requests to be merged. In case this recipe is still not ported to Conan 2.x, please, ping `@conan-io/barbarians` on the PR and we will help you.

<details>

<summary> See details: </summary>

Failure in build 1 (`a29e07940aa3ed676d1c8b2df5f52b6dcf29502c`):

 * **opentelemetry-cpp/1.7.0:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.3.0:**
   CI failed to create some packages ([All logs](https://c3i.jfrog.io/c3i/misc-v2/summary.html?json=https://c3i.jfrog.io/c3i/misc-v2/logs/pr/19793/1-linux-gcc/opentelemetry-cpp/1.3.0//summary.json))
   
   <details><summary>Logs for packageID <code>e457f44b633d2896c45adf5f0a633873a3e1d179</code>:</summary>
   
   ```
   [settings]
   arch=x86_64
   build_type=Release
   compiler=gcc
   compiler.cppstd=17
   compiler.libcxx=libstdc++11
   compiler.version=11
   os=Linux
   [options]
   */*:shared=False
   ```
   
   ```
   [...]
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/client/nosend/http_client_nosend.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/client/http_client.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/client/curl
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/client/curl/http_client_curl.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/client/curl/http_operation_curl.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/client/http_client_factory.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/common
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry//ext/http/common/url_parser.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_http_client_curl.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_otlp_recordable.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_otlp_grpc.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_otlp_grpc_log.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_otlp_http_client.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_otlp_http.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/protobuf_include_prefix.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_environment.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_http_log_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_log_recordable.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_http_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_grpc_exporter_options.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_grpc_log_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_grpc_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_http_client.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/otlp_recordable_utils.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//otlp/protobuf_include_suffix.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_ostream_span.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//ostream
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//ostream/metric_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//ostream/log_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//ostream/span_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//memory
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//memory/in_memory_span_data.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//memory/in_memory_span_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_zipkin_trace.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//zipkin
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//zipkin/zipkin_exporter.h
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/lib/libopentelemetry_exporter_jaeger_trace.a
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//jaeger
   -- Installing: /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p/include/opentelemetry/exporters//jaeger/jaeger_exporter.h
   
   opentelemetry-cpp/1.3.0: package(): Packaged 1 file: LICENSE
   opentelemetry-cpp/1.3.0: package(): Packaged 15 '.a' files
   opentelemetry-cpp/1.3.0: package(): Packaged 1 '.cmake' file: conan-official-opentelemetry-cpp-variables.cmake
   opentelemetry-cpp/1.3.0: package(): Packaged 282 '.h' files
   opentelemetry-cpp/1.3.0: Created package revision f17b0766d8bdc0fb04376e813a60f0d8
   opentelemetry-cpp/1.3.0: Package 'e457f44b633d2896c45adf5f0a633873a3e1d179' created
   opentelemetry-cpp/1.3.0: Full package reference: opentelemetry-cpp/1.3.0#85d8647b6d1fabf31d639c6fec641bc7:e457f44b633d2896c45adf5f0a633873a3e1d179#f17b0766d8bdc0fb04376e813a60f0d8
   opentelemetry-cpp/1.3.0: Package folder /home/conan/w/prod-v2/bsr/7179/aecee/p/b/opent9472c43d66230/p
   ERROR: opentelemetry-cpp/1.3.0: required component package 'opentelemetry-proto::' not in dependencies
   ```
   
   </details>

 * **opentelemetry-cpp/1.2.0:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.0.1:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.4.1:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.6.1:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.9.1:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.8.1:**
   Didn't run or was cancelled before finishing

 * **opentelemetry-cpp/1.4.0:**
   Didn't run or was cancelled before finishing

---

<sup>**Note:** To save resources, CI tries to finish as soon as an error is found. For this reason you might find that not all the references have been launched or not all the configurations for a given reference. Also, take into account that we cannot guarantee the order of execution as it depends on CI workload and workers availability.</sup>

</details>

Resolving patch:
diff --git a/recipes/opentelemetry-cpp/all/conanfile.py b/recipes/opentelemetry-cpp/all/conanfile.py
--- a/recipes/opentelemetry-cpp/all/conanfile.py
+++ b/recipes/opentelemetry-cpp/all/conanfile.py
@@ -1,16 +1,15 @@
-from conan import ConanFile
+from conan import ConanFile, conan_version
 from conan.errors import ConanInvalidConfiguration
-from conan.tools.files import apply_conandata_patches, export_conandata_patches, get, copy, rmdir, replace_in_file, save
+from conan.tools.files import get, copy, rmdir, replace_in_file, save
 from conan.tools.build import check_min_cppstd
 from conan.tools.scm import Version
 from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
-from conan.tools.microsoft import check_min_vs
-from conan.tools.env import Environment
+from conan.tools.env import VirtualRunEnv, VirtualBuildEnv
 
 import os
 import textwrap
 
-required_conan_version = ">=1.53.0"
+required_conan_version = ">=1.56.0 <2 || >=2.0.6"
 
 class OpenTelemetryCppConan(ConanFile):
     name = "opentelemetry-cpp"
@@ -28,7 +27,7 @@ class OpenTelemetryCppConan(ConanFile):
         "with_stl": [True, False],
         "with_gsl": [True, False],
         "with_abseil": [True, False],
-        "with_otlp": [True, False],
+        "with_otlp": ["deprecated", True, False],
         "with_otlp_grpc": [True, False],
         "with_otlp_http": [True, False],
         "with_zipkin": [True, False],
@@ -50,7 +49,7 @@ class OpenTelemetryCppConan(ConanFile):
         "with_stl": False,
         "with_gsl": False,
         "with_abseil": True,
-        "with_otlp": True,
+        "with_otlp": "deprecated",
         "with_otlp_grpc": True,
         "with_otlp_http": True,
         "with_zipkin": True,
@@ -67,23 +66,39 @@ class OpenTelemetryCppConan(ConanFile):
     short_paths = True
 
     @property
-    def _minimum_cpp_standard(self):
+    def _min_cppstd(self):
+        if self.options.with_abseil and Version(self.dependencies["abseil"].ref.version) >= "20230125":
+            return 14
         return 11
 
-    def export_sources(self):
-        export_conandata_patches(self)
+    @property
+    def _compilers_minimum_version(self):
+        if self._min_cppstd == 14:
+            return {
+                "gcc": "6",
+                "clang": "5",
+                "apple-clang": "10",
+                "Visual Studio": "16",
+                "msvc": "192",
+            }
+        else:
+            return {
+                "Visual Studio": "16",
+                "msvc": "192",
+            }
 
     def config_options(self):
         if self.settings.os == "Windows":
             self.options.rm_safe("fPIC")
+        if Version(self.version) >= "1.10":
+            del self.options.with_jaeger
 
     def configure(self):
         if self.options.shared:
             self.options.rm_safe("fPIC")
-
-        if not self.options.with_otlp:
-            self.options.rm_safe("with_otlp_grpc")
-            self.options.rm_safe("with_otlp_http")
+        if self.options.with_otlp != "deprecated":
+            self.output.warning(f"{self.ref}:with_otlp option is deprecated, do not use anymore. "
+                                "Please, consider with_otlp_grpc or with_otlp_http instead.")
 
     def layout(self):
         cmake_layout(self, src_folder="src")
@@ -93,21 +108,15 @@ def requirements(self):
             self.requires("ms-gsl/4.0.0")
 
         if self.options.with_abseil:
-            self.requires("abseil/20220623.0", transitive_headers=True)
+            self.requires("abseil/20230125.3", transitive_headers=True)
 
-        if self.options.with_otlp:
-            self.requires("protobuf/3.21.9")
-            if Version(self.version) <= "1.4.1":
-                self.requires("opentelemetry-proto/0.11.0")
-            else:
-                self.requires("opentelemetry-proto/0.20.0")
-
-            if self.options.get_safe("with_otlp_grpc"):
-                self.requires("grpc/1.50.1")
+        if self.options.with_otlp_grpc:
+            self.requires("protobuf/3.21.12", transitive_headers=True, transitive_libs=True)
+            self.requires("grpc/1.54.3", transitive_headers=True, transitive_libs=True)
 
         if (self.options.with_zipkin or
            self.options.with_elasticsearch or
-           self.options.get_safe("with_otlp_http") or
+           self.options.with_otlp_http or
            self.options.with_etw
         ):
            self.requires("nlohmann_json/3.11.2")
@@ -115,38 +124,34 @@ def requirements(self):
 
         if (self.options.with_zipkin or
            self.options.with_elasticsearch or
-           self.options.get_safe("with_otlp_http")
+           self.options.with_otlp_http
         ):
-           self.requires("libcurl/8.1.1")
+           self.requires("libcurl/[>=7.78.0 <9]")
 
         if self.options.with_prometheus:
             self.requires("prometheus-cpp/1.1.0")
 
-        if self.options.with_jaeger:
+        if self.options.get_safe("with_jaeger"):
             self.requires("thrift/0.17.0")
-
-            if Version(self.version) >= "1.3.0":
-                self.requires("boost/1.82.0")
+            self.requires("boost/1.82.0")
 
     @property
     def _required_boost_components(self):
-        return ["locale"] if self.options.with_jaeger and Version(self.version) >= "1.3.0" else []
+        return ["locale"] if self.options.get_safe("with_jaeger") else []
 
     def validate(self):
-        if self.settings.get_safe("compiler.cppstd"):
-            check_min_cppstd(self, self._minimum_cpp_standard)
-        check_min_vs(self, "192")
+        if self.settings.compiler.cppstd:
+            check_min_cppstd(self, self._min_cppstd)
+        minimum_version = self._compilers_minimum_version.get(str(self.settings.compiler), False)
+        if minimum_version and Version(self.settings.compiler.version) < minimum_version:
+            raise ConanInvalidConfiguration(
+                f"{self.ref} requires C++{self._min_cppstd}, which your compiler does not support."
+            )
 
         if self.settings.os != "Linux" and self.options.shared:
             raise ConanInvalidConfiguration(f"{self.ref} supports building shared libraries only on Linux")
 
-        if self.options.get_safe("with_otlp_grpc") and not self.options.with_otlp:
-            raise ConanInvalidConfiguration("Option 'with_otlp_grpc' requires 'with_otlp'")
-
-        if self.options.get_safe("with_otlp_http") and not self.options.with_otlp:
-            raise ConanInvalidConfiguration("Option 'with_otlp_http' requires 'with_otlp'")
-
-        if self.options.get_safe("with_otlp_grpc"):
+        if self.options.with_otlp_grpc:
             if not self.dependencies["grpc"].options.cpp_plugin:
                 raise ConanInvalidConfiguration(f"{self.ref} requires grpc with cpp_plugin=True")
 
@@ -159,11 +164,16 @@ def validate(self):
                 f"{', '.join(self._required_boost_components)}"
             )
 
+        if conan_version.major == 1 and self.settings.compiler == "apple-clang" and Version(self.version) >= "1.12.0":
+            # Only fails on apple-clang in this configuration for some reason:
+            # https://github.com/conan-io/conan-center-index/pull/21332#issuecomment-1830766894
+            raise ConanInvalidConfiguration("opentelemetry-cpp >= 1.12.0 does not support Apple Clang on Conan v1")
+
     def build_requirements(self):
-        if self.options.with_otlp:
-            self.tool_requires("protobuf/3.21.9")
-            if self.options.get_safe("with_otlp_grpc"):
-                self.tool_requires("grpc/1.50.1")
+        if self.options.with_otlp_grpc:
+            self.tool_requires("opentelemetry-proto/1.0.0")
+            self.tool_requires("protobuf/<host_version>")
+            self.tool_requires("grpc/<host_version>")
 
     def _create_cmake_module_variables(self, module_file):
         content = textwrap.dedent("""\
@@ -176,72 +186,68 @@ def _create_cmake_module_variables(self, module_file):
         """)
         save(self, module_file, content)
 
+    def package_id(self):
+        # deprecated
+        del self.info.options.with_otlp
+
     def source(self):
         get(self, **self.conan_data["sources"][self.version], strip_root=True)
 
     def generate(self):
-        tc = CMakeToolchain(self)
+        VirtualBuildEnv(self).generate(scope="build")
+        VirtualRunEnv(self).generate(scope="build")
 
-        tc.variables["BUILD_TESTING"] = False
-        tc.variables["BUILD_BENCHMARK"] = False
-
-        tc.variables["WITH_EXAMPLES"] = False
-        tc.variables["WITH_NO_DEPRECATED_CODE"] = self.options.with_no_deprecated_code
-        tc.variables["WITH_STL"] = self.options.with_stl
-        tc.variables["WITH_GSL"] = self.options.with_gsl
-        tc.variables["WITH_ABSEIL"] = self.options.with_abseil
-        tc.variables["WITH_OTLP"] = self.options.with_otlp
-        tc.variables["WITH_OTLP_GRPC"] = self.options.get_safe("with_otlp_grpc")
-        tc.variables["WITH_OTLP_HTTP"] = self.options.get_safe("with_otlp_http")
-        tc.variables["WITH_ZIPKIN"] = self.options.with_zipkin
-        tc.variables["WITH_PROMETHEUS"] = self.options.with_prometheus
-        tc.variables["WITH_ELASTICSEARCH"] = self.options.with_elasticsearch
-        tc.variables["WITH_ZPAGES"] = self.options.with_zpages
-        tc.variables["WITH_JAEGER"] = self.options.with_jaeger
-        tc.variables["WITH_NO_GETENV"] = self.options.with_no_getenv
-        tc.variables["WITH_ETW"] = self.options.with_etw
-        tc.variables["WITH_LOGS_PREVIEW"] = self.options.with_logs_preview
-        tc.variables["WITH_ASYNC_EXPORT_PREVIEW"] = self.options.with_async_export_preview
-        tc.variables["WITH_METRICS_EXEMPLAR_PREVIEW"] = self.options.with_metrics_exemplar_preview
+        tc = CMakeToolchain(self)
+        tc.cache_variables["BUILD_TESTING"] = False
+        tc.cache_variables["BUILD_BENCHMARK"] = False
+        tc.cache_variables["WITH_EXAMPLES"] = False
+        tc.cache_variables["WITH_NO_DEPRECATED_CODE"] = self.options.with_no_deprecated_code
+        tc.cache_variables["WITH_STL"] = self.options.with_stl
+        tc.cache_variables["WITH_GSL"] = self.options.with_gsl
+        tc.cache_variables["WITH_ABSEIL"] = self.options.with_abseil
+        if Version(self.version) < "1.10":
+            tc.cache_variables["WITH_OTLP"] = self.options.with_otlp_grpc or self.options.with_otlp_http
+        tc.cache_variables["WITH_OTLP_GRPC"] = self.options.with_otlp_grpc
+        tc.cache_variables["WITH_OTLP_HTTP"] = self.options.with_otlp_http
+        tc.cache_variables["WITH_ZIPKIN"] = self.options.with_zipkin
+        tc.cache_variables["WITH_PROMETHEUS"] = self.options.with_prometheus
+        tc.cache_variables["WITH_ELASTICSEARCH"] = self.options.with_elasticsearch
+        tc.cache_variables["WITH_ZPAGES"] = self.options.with_zpages
+        tc.cache_variables["WITH_JAEGER"] = self.options.get_safe("with_jaeger", False)
+        tc.cache_variables["WITH_NO_GETENV"] = self.options.with_no_getenv
+        tc.cache_variables["WITH_ETW"] = self.options.with_etw
+        tc.cache_variables["WITH_LOGS_PREVIEW"] = self.options.with_logs_preview
+        tc.cache_variables["WITH_ASYNC_EXPORT_PREVIEW"] = self.options.with_async_export_preview
+        tc.cache_variables["WITH_METRICS_EXEMPLAR_PREVIEW"] = self.options.with_metrics_exemplar_preview
+        tc.cache_variables["OPENTELEMETRY_INSTALL"] = True
+        if not self.settings.compiler.cppstd:
+            tc.variables["CMAKE_CXX_STANDARD"] = self._min_cppstd
         tc.generate()
 
-        tc = CMakeDeps(self)
-        tc.generate()
+        deps = CMakeDeps(self)
 
-        if self.settings.os == "Linux":
-            env = Environment()
-            if self.dependencies["grpc"].options.shared:
-                env.append_path("LD_LIBRARY_PATH", os.path.join(self.dependencies["grpc"].package_folder, "lib"))
-            if self.dependencies["protobuf"].options.shared:
-                env.append_path("LD_LIBRARY_PATH", os.path.join(self.dependencies["protobuf"].package_folder, "lib"))
-            env.vars(self).save_script("conanbuild_loadpath")
+        deps.generate()
 
     def _patch_sources(self):
-        protos_path = self.dependencies["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/")
-        protos_cmake_path = os.path.join(
-            self.source_folder,
-            "cmake",
-            "opentelemetry-proto.cmake")
-        if Version(self.version) >= "1.1.0":
-            replace_in_file(self,
-                protos_cmake_path,
-                "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)",
-                "if(1)")
-        if Version(self.version) < "1.9.0":
-            replace_in_file(self,
-                protos_cmake_path,
-                "set(PROTO_PATH \"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto\")",
-                f"set(PROTO_PATH \"{protos_path}\")")
-        else:
-            replace_in_file(self,
-                protos_cmake_path,
-                "\"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto\")",
-                f"\"{protos_path}\")")
+        if self.options.with_otlp_http or self.options.with_otlp_grpc:
+            protos_path = self.dependencies.build["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/")
+            protos_cmake_path = os.path.join(self.source_folder, "cmake", "opentelemetry-proto.cmake")
+            replace_in_file(self, protos_cmake_path,
+                            "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)",
+                            "if(1)")
+            if Version(self.version) < "1.8.3":
+                replace_in_file(self, protos_cmake_path,
+                                'set(PROTO_PATH "${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")',
+                                f'set(PROTO_PATH "{protos_path}")')
+            else:
+                replace_in_file(self, protos_cmake_path,
+                                '"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")',
+                                f'"{protos_path}")')
+            if self.options.with_otlp_grpc and Version(self.version) < "1.9.1":
+                save(self, protos_cmake_path, "\ntarget_link_libraries(opentelemetry_proto PUBLIC gRPC::grpc++)", append=True)
 
         rmdir(self, os.path.join(self.source_folder, "api", "include", "opentelemetry", "nostd", "absl"))
 
-        apply_conandata_patches(self)
-
     def build(self):
         self._patch_sources()
         cmake = CMake(self)
@@ -253,6 +259,7 @@ def package(self):
         cmake = CMake(self)
         cmake.install()
         rmdir(self, os.path.join(self.package_folder, "lib", "cmake"))
+        rmdir(self, os.path.join(self.package_folder, "lib", "pkgconfig"))
         self._create_cmake_module_variables(
             os.path.join(self.package_folder, self._otel_cmake_variables_path)
         )
@@ -272,7 +279,7 @@ def _otel_build_modules(self):
 
     @property
     def _http_client_name(self):
-        return "http_client_curl" if Version(self.version) < "1.3.0" else "opentelemetry_http_client_curl"
+        return "opentelemetry_http_client_curl"
 
     @property
     def _otel_libraries(self):
@@ -285,64 +292,41 @@ def _otel_libraries(self):
             "opentelemetry_trace",
             "opentelemetry_version",
         ]
-
-        if self.options.with_otlp:
+        if self.options.with_otlp_grpc or self.options.with_otlp_http:
             libraries.extend([
                 "opentelemetry_proto",
                 "opentelemetry_otlp_recordable",
                 ])
-
-            if self.options.get_safe("with_otlp_grpc"):
+            if self.options.with_otlp_grpc:
                 libraries.append("opentelemetry_exporter_otlp_grpc")
-
-                if Version(self.version) >= "1.5.0":
-                    libraries.append("opentelemetry_exporter_otlp_grpc_metrics")
-
+                libraries.append("opentelemetry_exporter_otlp_grpc_metrics")
                 if Version(self.version) >= "1.7.0":
                     libraries.append("opentelemetry_exporter_otlp_grpc_client")
-
                 if self.options.with_logs_preview:
                     libraries.append("opentelemetry_exporter_otlp_grpc_log")
-
-            if self.options.get_safe("with_otlp_http"):
+            if self.options.with_otlp_http:
                 libraries.append("opentelemetry_exporter_otlp_http")
-
-                if Version(self.version) >= "1.1.0":
-                    libraries.append("opentelemetry_exporter_otlp_http_client")
-
-                if Version(self.version) >= "1.5.0":
-                    libraries.append("opentelemetry_exporter_otlp_http_metric")
-
+                libraries.append("opentelemetry_exporter_otlp_http_client")
+                libraries.append("opentelemetry_exporter_otlp_http_metric")
                 if self.options.with_logs_preview:
                     libraries.append("opentelemetry_exporter_otlp_http_log")
-
         if self.options.with_prometheus:
             libraries.append("opentelemetry_exporter_prometheus")
-
         if self.options.with_elasticsearch and self.options.with_logs_preview:
             libraries.append("opentelemetry_exporter_elasticsearch_logs")
-
         if self.options.with_zipkin:
             libraries.append("opentelemetry_exporter_zipkin_trace")
-
-        if self.options.with_jaeger:
+        if self.options.get_safe("with_jaeger"):
             libraries.append("opentelemetry_exporter_jaeger_trace")
-
-        if Version(self.version) >= "1.2.0":
-            libraries.append("opentelemetry_metrics")
-
-        if Version(self.version) >= "1.4.0":
-            libraries.append("opentelemetry_exporter_ostream_metrics")
-
+        libraries.append("opentelemetry_metrics")
+        libraries.append("opentelemetry_exporter_ostream_metrics")
         if self.options.with_logs_preview:
             libraries.extend([
                 "opentelemetry_logs",
                 "opentelemetry_exporter_ostream_logs",
             ])
-
         if self.settings.os == "Windows" and self.options.with_etw:
             libraries.append("opentelemetry_exporter_etw")
-
         return libraries
 
     def package_info(self):
@@ -391,20 +375,16 @@ def package_info(self):
             self.cpp_info.components["opentelemetry_common"].defines.append("HAVE_ABSEIL")
             self.cpp_info.components["opentelemetry_common"].requires.append("abseil::abseil")
 
-        if self.options.with_otlp:
-            self.cpp_info.components["opentelemetry_proto"].requires.extend([
-                "opentelemetry-proto::opentelemetry-proto",
-                "protobuf::protobuf",
-            ])
-
+        if self.options.with_otlp_http or self.options.with_otlp_grpc:
+            self.cpp_info.components["opentelemetry_proto"].requires.append("protobuf::protobuf")
             self.cpp_info.components["opentelemetry_otlp_recordable"].requires.extend([
                 "opentelemetry_proto",
                 "opentelemetry_resources",
                 "opentelemetry_trace",
             ])
 
-        if self.options.get_safe("with_otlp_grpc"):
-            if Version(self.version) >= "1.5.0" and Version(self.version) < "1.7.0":
+        if self.options.with_otlp_grpc:
+            if "1.5.0" <= Version(self.version) < "1.7.0":
                 self.cpp_info.components["opentelemetry_exporter_otlp_grpc_metrics"].requires.extend([
                     "grpc::grpc++",
                     "opentelemetry_otlp_recordable",
@@ -438,14 +418,14 @@ def package_info(self):
                     "opentelemetry_exporter_otlp_grpc_client",
                 ])
 
-        if (self.options.get_safe("with_otlp_http") or
+        if (self.options.with_otlp_http or
             self.options.with_zipkin or
             self.options.with_elasticsearch
         ):
             self.cpp_info.components[self._http_client_name].requires.append("libcurl::libcurl")
             self.cpp_info.components[self._http_client_name].requires.append("openssl::openssl")
 
-        if self.options.get_safe("with_otlp_http"):
+        if self.options.with_otlp_http:
             self.cpp_info.components["opentelemetry_exporter_otlp_http_client"].requires.extend([
                 self._http_client_name,
                 "nlohmann_json::nlohmann_json",
@@ -457,11 +437,10 @@ def package_info(self):
                 "opentelemetry_exporter_otlp_http_client",
             ])
 
-            if Version(self.version) >= "1.5.0":
-                self.cpp_info.components["opentelemetry_exporter_otlp_http_metric"].requires.extend([
-                    "opentelemetry_otlp_recordable",
-                    "opentelemetry_exporter_otlp_http_client"
-                ])
+            self.cpp_info.components["opentelemetry_exporter_otlp_http_metric"].requires.extend([
+                "opentelemetry_otlp_recordable",
+                "opentelemetry_exporter_otlp_http_client"
+            ])
 
             if self.options.with_logs_preview:
                 self.cpp_info.components["opentelemetry_exporter_otlp_http_log"].requires.extend([
@@ -476,7 +455,7 @@ def package_info(self):
                 "opentelemetry_trace",
             ])
 
-        if self.options.with_jaeger:
+        if self.options.get_safe("with_jaeger"):
             self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.extend([
                 self._http_client_name,
                 "openssl::openssl",
@@ -484,10 +463,9 @@ def package_info(self):
                 "thrift::thrift",
             ])
 
-            if Version(self.version) >= "1.3.0":
-                self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.append(
-                    "boost::locale"
-                )
+            self.cpp_info.components["opentelemetry_exporter_jaeger_trace"].requires.append(
+                "boost::locale"
+            )
 
         if self.settings.os == "Windows" and self.options.with_etw:
             self.cpp_info.components["opentelemetry_exporter_etw"].libs = []


Test patch: