From db1f42b5da0fa276e083a93676cfc1a421521d3f Mon Sep 17 00:00:00 2001 From: ToruNiina Date: Fri, 2 Apr 2021 17:21:25 +0900 Subject: [PATCH] fix: enable to control macro definition --- CMakeLists.txt | 8 +++++++- toml/macros.hpp | 7 +++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a990456..645b185 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -40,7 +40,13 @@ endif() if(MSVC) add_definitions("/Zc:__cplusplus") # define __cplusplus value correctly add_definitions("/utf-8") # enable to use u8"" literal - add_definitions("/Zc:preprocessor") + if(MSVC_VERSION LESS 1910) + add_definitions(-DTOML11_WITHOUT_DEFINE_NON_INTRUSIVE) + elseif(MSVC_VERSION LESS 1920) + add_definitions("/experimental:preprocessor") # MSVC 2017 + else() + add_definitions("/Zc:preprocessor") # MSVC 2019 + endif() endif() # Set some common directories diff --git a/toml/macros.hpp b/toml/macros.hpp index 4d47857..e8f91ae 100644 --- a/toml/macros.hpp +++ b/toml/macros.hpp @@ -7,6 +7,11 @@ #define TOML11_CONCATENATE_AUX(x, y) x##y #define TOML11_CONCATENATE(x, y) TOML11_CONCATENATE_AUX(x, y) +// ============================================================================ +// TOML11_DEFINE_CONVERSION_NON_INTRUSIVE + +#ifndef TOML11_WITHOUT_DEFINE_NON_INTRUSIVE + // ---------------------------------------------------------------------------- // TOML11_ARGS_SIZE @@ -111,4 +116,6 @@ }; \ } /* toml */ +#endif// TOML11_WITHOUT_DEFINE_NON_INTRUSIVE + #endif// TOML11_MACROS_HPP