CLI11 2.1.2
Macros.hpp
Go to the documentation of this file.
1// Copyright (c) 2017-2021, 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
44// [CLI11:macros_hpp:end]