diff --git a/CHANGELOG.md b/CHANGELOG.md index b18a9512898..7e1b02456f7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -15,6 +15,8 @@ Increment the: ## [Unreleased] +* [BUILD] Allow to use local GSL + ## [1.0.0-rc3] 2021-07-12 * [DOCS] Add doxygen reference docs for SDK ([#902](https://github.com/open-telemetry/opentelemetry-cpp/pull/902)) diff --git a/CMakeLists.txt b/CMakeLists.txt index c587a5c51dc..822e78bf371 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -118,8 +118,13 @@ if(WITH_STL) # Guidelines Support Library path. Used if we are not on not get C++20. # # TODO: respect WITH_ABSEIL as alternate implementation of std::span - set(GSL_DIR third_party/ms-gsl) - include_directories(${GSL_DIR}/include) + find_package(Microsoft.GSL QUIET) + if(TARGET Microsoft.GSL::GSL) + list(APPEND CORE_RUNTIME_LIBS Microsoft.GSL::GSL) + else() + set(GSL_DIR third_party/ms-gsl) + include_directories(${GSL_DIR}/include) + endif() # Optimize for speed to reduce the hops if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")