Skip to content

Commit

Permalink
splunk-opentelemetry-cpp: require C++14
Browse files Browse the repository at this point in the history
  • Loading branch information
valgur committed May 26, 2024
1 parent 43e27d8 commit 90b3d3c
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 5 deletions.
27 changes: 24 additions & 3 deletions recipes/splunk-opentelemetry-cpp/all/conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from conan.tools.build import check_min_cppstd
from conan.tools.cmake import CMake, CMakeDeps, CMakeToolchain, cmake_layout
from conan.tools.files import copy, get, rmdir, export_conandata_patches, apply_conandata_patches
from conan.tools.scm import Version

required_conan_version = ">=1.53.0"

Expand All @@ -29,6 +30,20 @@ class SplunkOpentelemetryConan(ConanFile):
"fPIC": True,
"build_jaeger_exporter": True,
}
@property
def _min_cppstd(self):
return 14

@property
def _compilers_minimum_version(self):
return {
"gcc": "6",
"clang": "5",
"apple-clang": "10",
"Visual Studio": "16",
"msvc": "192",
}


def export_sources(self):
export_conandata_patches(self)
Expand All @@ -53,13 +68,19 @@ def requirements(self):
self.requires("libcurl/[>=7.78.0 <9]")

def validate(self):
if self.settings.compiler.get_safe("cppstd"):
check_min_cppstd(self, 11)
if self.settings.arch != "x86_64":
raise ConanInvalidConfiguration("Architecture not supported")
raise ConanInvalidConfiguration(f"{self.settings.arch} architecture not supported")
if self.options.build_jaeger_exporter and not self.dependencies["opentelemetry-cpp"].options.get_safe("with_jaeger"):
raise ConanInvalidConfiguration("Cannot build Jaeger exporter without with_jaeger=True in opentelemetry-cpp")

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."
)

def source(self):
get(self, **self.conan_data["sources"][self.version], strip_root=True)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
cmake_minimum_required(VERSION 3.15)
project(test_package CXX)

set(CMAKE_CXX_STANDARD 11)

find_package(SplunkOpenTelemetry CONFIG REQUIRED)

add_executable(test_package test_package.cpp)
target_link_libraries(test_package SplunkOpenTelemetry::SplunkOpenTelemetry)
target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_14)

0 comments on commit 90b3d3c

Please sign in to comment.