From e19e13fa0a9b19a13c7146e8d613e5c37ce4043e Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Tue, 24 Oct 2023 17:22:47 +0000 Subject: [PATCH] build: use std:: proxy for nonstd:: on non-macOS The nonstd:: implementation of nonstd::variant was causing a link error in the Debug configuration on MSYS2 CLANG64. Set the macros for choosing the implementation of both nonstd::optional and nonstd::variant to the std:: forwarding behavior on all platforms other than macOS. Signed-off-by: Rafael Kitover --- CMakeLists.txt | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index ccf5475d..fc69437d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -491,8 +491,13 @@ add_definitions(-D__STDC_FORMAT_MACROS) # For C++, default to nonstd::optional and nonstd::variant for now due to mac # build issues. -add_definitions(-Doptional_CONFIG_SELECT_OPTIONAL=optional_OPTIONAL_NONSTD) -add_definitions(-Dvariant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD) +if(APPLE) + add_definitions(-Doptional_CONFIG_SELECT_OPTIONAL=optional_OPTIONAL_NONSTD) + add_definitions(-Dvariant_CONFIG_SELECT_VARIANT=variant_VARIANT_NONSTD) +else() + add_definitions(-Doptional_CONFIG_SELECT_OPTIONAL=optional_OPTIONAL_STD) + add_definitions(-Dvariant_CONFIG_SELECT_VARIANT=variant_VARIANT_STD) +endif() if(ENABLE_LINK) # IPC linking code needs sem_timedwait which can be either in librt or pthreads