CLI11
C++11 Command Line Interface Parser
Macros.hpp
1 #pragma once
2 
3 // Distributed under the 3-Clause BSD License. See accompanying
4 // file LICENSE or https://github.com/CLIUtils/CLI11 for details.
5 
6 // [CLI11:verbatim]
7 
8 // The following version macro is very similar to the one in PyBind11
9 #if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER)
10 #if __cplusplus >= 201402L
11 #define CLI11_CPP14
12 #if __cplusplus >= 201703L
13 #define CLI11_CPP17
14 #if __cplusplus > 201703L
15 #define CLI11_CPP20
16 #endif
17 #endif
18 #endif
19 #elif defined(_MSC_VER) && __cplusplus == 199711L
20 // MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully implemented)
21 // Unless you use the /Zc:__cplusplus flag on Visual Studio 2017 15.7 Preview 3 or newer
22 #if _MSVC_LANG >= 201402L
23 #define CLI11_CPP14
24 #if _MSVC_LANG > 201402L && _MSC_VER >= 1910
25 #define CLI11_CPP17
26 #if __MSVC_LANG > 201703L && _MSC_VER >= 1910
27 #define CLI11_CPP20
28 #endif
29 #endif
30 #endif
31 #endif
32 
33 #if defined(CLI11_CPP14)
34 #define CLI11_DEPRECATED(reason) [[deprecated(reason)]]
35 #elif defined(_MSC_VER)
36 #define CLI11_DEPRECATED(reason) __declspec(deprecated(reason))
37 #else
38 #define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason)))
39 #endif
40 
41 // [CLI11:verbatim]