|
4 | 4 | from conan.tools.files import get, copy, rmdir, replace_in_file |
5 | 5 | from conan.tools.build import check_min_cppstd |
6 | 6 | from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout |
| 7 | +from conan.tools.scm import Version |
7 | 8 |
|
8 | 9 | import os |
9 | 10 |
|
@@ -179,12 +180,21 @@ def _patch_sources(self): |
179 | 180 | if self._needs_proto: |
180 | 181 | protos_path = self.dependencies.build["opentelemetry-proto"].conf_info.get("user.opentelemetry-proto:proto_root").replace("\\", "/") |
181 | 182 | protos_cmake_path = os.path.join(self.source_folder, "cmake", "opentelemetry-proto.cmake") |
182 | | - replace_in_file(self, protos_cmake_path, |
183 | | - "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)", |
184 | | - "if(1)") |
185 | | - replace_in_file(self, protos_cmake_path, |
186 | | - '"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")', |
187 | | - f'"{protos_path}")') |
| 183 | + |
| 184 | + if Version(self.version) < "1.22.0": |
| 185 | + replace_in_file(self, protos_cmake_path, |
| 186 | + "if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto/.git)", |
| 187 | + "if(1)") |
| 188 | + replace_in_file(self, protos_cmake_path, |
| 189 | + '"${CMAKE_CURRENT_SOURCE_DIR}/third_party/opentelemetry-proto")', |
| 190 | + f'"{protos_path}")') |
| 191 | + else: |
| 192 | + replace_in_file(self, protos_cmake_path, |
| 193 | + "elseif(EXISTS ${OPENTELEMETRY_PROTO_SUBMODULE}/.git)", |
| 194 | + "elseif(1)") |
| 195 | + replace_in_file(self, protos_cmake_path, |
| 196 | + 'SOURCE_DIR ${OPENTELEMETRY_PROTO_SUBMODULE}', |
| 197 | + f'SOURCE_DIR ${protos_path}') |
188 | 198 |
|
189 | 199 | rmdir(self, os.path.join(self.source_folder, "api", "include", "opentelemetry", "nostd", "absl")) |
190 | 200 |
|
|
0 commit comments