From 29a7b13718b020f3af4be6136e5025fd94f57827 Mon Sep 17 00:00:00 2001 From: Olivier Le Doeuff Date: Thu, 4 Aug 2022 18:25:21 +0200 Subject: [PATCH] Only use embedded GSL if there is no target "GSL" When using stduuid with FetchContent/CPM.cmake, and also including GSL with such process, it create a conflict and it then become ambiguous which file is used where. Concrete use case: ```cmake CPMAddPackage( NAME GSL GIT_REPOSITORY "https://github.com/microsoft/GSL" GIT_TAG "v4.0.0" ) CPMAddPackage( NAME stduuid GIT_REPOSITORY "https://github.com/mariusbancila/stduuid" GIT_TAG "master" ) ``` --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 73b5658..dcbdb75 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,7 +43,7 @@ if (UUID_TIME_GENERATOR) endif() # Using span from std -if (NOT UUID_USING_CXX20_SPAN) +if (NOT UUID_USING_CXX20_SPAN AND NOT TARGET GSL) target_include_directories(${PROJECT_NAME} INTERFACE $ $)