From 265aae805646dd3b6e8b85001c22806b055d18cf Mon Sep 17 00:00:00 2001 From: owent Date: Wed, 21 Jul 2021 15:22:33 +0800 Subject: [PATCH] Allow to use local GSL Signed-off-by: owent --- CHANGELOG.md | 2 ++ CMakeLists.txt | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b18a951289..7e1b02456f 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 c587a5c51d..822e78bf37 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")