CLI11 2.2.0
Loading...
Searching...
No Matches
Macros.hpp
Go to the documentation of this file.
1// Copyright (c) 2017-2022, University of Cincinnati, developed by Henry Schreiner
2// under NSF AWARD 1414736 and by the respective contributors.
3// All rights reserved.
4//
5// SPDX-License-Identifier: BSD-3-Clause
6
7#pragma once
8
9// [CLI11:macros_hpp:verbatim]
10
11// The following version macro is very similar to the one in pybind11
12#if !(defined(_MSC_VER) && __cplusplus == 199711L) && !defined(__INTEL_COMPILER)
13#if __cplusplus >= 201402L
14#define CLI11_CPP14
15#if __cplusplus >= 201703L
16#define CLI11_CPP17
17#if __cplusplus > 201703L
18#define CLI11_CPP20
19#endif
20#endif
21#endif
22#elif defined(_MSC_VER) && __cplusplus == 199711L
23// MSVC sets _MSVC_LANG rather than __cplusplus (supposedly until the standard is fully implemented)
24// Unless you use the /Zc:__cplusplus flag on Visual Studio 2017 15.7 Preview 3 or newer
25#if _MSVC_LANG >= 201402L
26#define CLI11_CPP14
27#if _MSVC_LANG > 201402L && _MSC_VER >= 1910
28#define CLI11_CPP17
29#if _MSVC_LANG > 201703L && _MSC_VER >= 1910
30#define CLI11_CPP20
31#endif
32#endif
33#endif
34#endif
35
36#if defined(CLI11_CPP14)
37#define CLI11_DEPRECATED(reason) [[deprecated(reason)]]
38#elif defined(_MSC_VER)
39#define CLI11_DEPRECATED(reason) __declspec(deprecated(reason))
40#else
41#define CLI11_DEPRECATED(reason) __attribute__((deprecated(reason)))
42#endif
43
45#ifndef CLI11_USE_STATIC_RTTI
46#if(defined(_HAS_STATIC_RTTI) && _HAS_STATIC_RTTI)
47#define CLI11_USE_STATIC_RTTI 1
48#elif defined(__cpp_rtti)
49#if(defined(_CPPRTTI) && _CPPRTTI == 0)
50#define CLI11_USE_STATIC_RTTI 1
51#else
52#define CLI11_USE_STATIC_RTTI 0
53#endif
54#elif(defined(__GCC_RTTI) && __GXX_RTTI)
55#define CLI11_USE_STATIC_RTTI 0
56#else
57#define CLI11_USE_STATIC_RTTI 1
58#endif
59#endif
60// [CLI11:macros_hpp:end]