From ec1cafb9f9ed15306a8f1a16f736b734cca4ae54 Mon Sep 17 00:00:00 2001 From: "chss95cs@gmail.com" Date: Sun, 30 Oct 2022 09:01:55 -0700 Subject: [PATCH] Fix building under clang-cl on windows, selectany cannot be used in the same way on it --- include/cxxopts.hpp | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/include/cxxopts.hpp b/include/cxxopts.hpp index 5a57448..8028b67 100644 --- a/include/cxxopts.hpp +++ b/include/cxxopts.hpp @@ -50,12 +50,12 @@ THE SOFTWARE. # define CXXOPTS_NO_REGEX true # endif #endif -#if defined(_MSC_VER) -#define CXXOPTS_LINKONCE_CONST __declspec(selectany) -#define CXXOPTS_LINKONCE __declspec(selectany) +#if defined(_MSC_VER) && !defined(__clang__) +#define CXXOPTS_LINKONCE_CONST __declspec(selectany) extern +#define CXXOPTS_LINKONCE __declspec(selectany) extern #else -#define CXXOPTS_LINKONCE_CONST const -#define CXXOPTS_LINKONCE +#define CXXOPTS_LINKONCE_CONST +#define CXXOPTS_LINKONCE #endif #ifndef CXXOPTS_NO_REGEX