Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve C++20 detection with CMake 3.12+ and gcc-9/c++20 support fixes #860

Merged
merged 9 commits into from
Jun 16, 2021
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ if(WITH_STL)
add_definitions(-DHAVE_CPP_STDLIB)
add_definitions(-DHAVE_GSL)
# Require at least C++17. C++20 is needed to avoid gsl::span
if(CMAKE_VERSION VERSION_GREATER 3.18.0)
if(CMAKE_VERSION VERSION_GREATER 3.11.999)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use VERSION_GREATER_EQUAL 3.12.0 to avoid using the crafted version number?

# Ask for 20, may get anything below
set(CMAKE_CXX_STANDARD 20)
else()
Expand Down
1 change: 1 addition & 0 deletions api/include/opentelemetry/std/variant.h
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ constexpr auto visit(_Callable &&_Obj, _Variants &&... _Args)
};

#else
using std::bad_variant_access;

template <std::size_t I, class... Types>
constexpr std::variant_alternative_t<I, std::variant<Types...>> &get(std::variant<Types...> &v)
Expand Down
2 changes: 1 addition & 1 deletion api/test/nostd/string_view_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include "opentelemetry/nostd/string_view.h"

#include <gtest/gtest.h>

#include <cstring>
#include <map>

using opentelemetry::nostd::string_view;
Expand Down