WCDH: Remove noise from generated defines.
The DECL part is redundant, and the language part is not needed. The source language and context already determines the language, so there is no need to repeat it in the define name.
This commit is contained in:
parent
eecd93fcca
commit
bc950169c7
|
@ -166,11 +166,11 @@ symbol, and compiler support determines what it is expanded to:
|
||||||
virtual void Execute() = 0;
|
virtual void Execute() = 0;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct Concrete Foo_CXX_FINAL {
|
struct Concrete Foo_FINAL {
|
||||||
void Execute() Foo_CXX_OVERRIDE;
|
void Execute() Foo_OVERRIDE;
|
||||||
};
|
};
|
||||||
|
|
||||||
In this case, ``Foo_CXX_FINAL`` will expand to ``final`` if the
|
In this case, ``Foo_FINAL`` will expand to ``final`` if the
|
||||||
compiler supports the keyword, or to empty otherwise.
|
compiler supports the keyword, or to empty otherwise.
|
||||||
|
|
||||||
In this use-case, the CMake code will wish to enable a particular language
|
In this use-case, the CMake code will wish to enable a particular language
|
||||||
|
@ -189,13 +189,13 @@ set to influence all following targets:
|
||||||
cxx_final cxx_override
|
cxx_final cxx_override
|
||||||
)
|
)
|
||||||
|
|
||||||
# Includes foo_compiler_detection.h and uses the Foo_DECL_CXX_FINAL symbol
|
# Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
|
||||||
# which will expand to 'final' if the compiler supports the requested
|
# which will expand to 'final' if the compiler supports the requested
|
||||||
# CXX_STANDARD.
|
# CXX_STANDARD.
|
||||||
add_library(foo foo.cpp)
|
add_library(foo foo.cpp)
|
||||||
set_property(TARGET foo PROPERTY CXX_STANDARD 11)
|
set_property(TARGET foo PROPERTY CXX_STANDARD 11)
|
||||||
|
|
||||||
# Includes foo_compiler_detection.h and uses the Foo_DECL_CXX_FINAL symbol
|
# Includes foo_compiler_detection.h and uses the Foo_FINAL symbol
|
||||||
# which will expand to 'final' if the compiler supports the feature,
|
# which will expand to 'final' if the compiler supports the feature,
|
||||||
# even though CXX_STANDARD is not set explicitly. The requirement of
|
# even though CXX_STANDARD is not set explicitly. The requirement of
|
||||||
# cxx_constexpr causes CMake to set CXX_STANDARD internally, which
|
# cxx_constexpr causes CMake to set CXX_STANDARD internally, which
|
||||||
|
|
|
@ -99,14 +99,14 @@
|
||||||
#
|
#
|
||||||
# .. code-block:: c++
|
# .. code-block:: c++
|
||||||
#
|
#
|
||||||
# class MyClass ClimbingStats_DECL_CXX_FINAL
|
# class MyClass ClimbingStats_FINAL
|
||||||
# {
|
# {
|
||||||
# ClimbingStats_DECL_CXX_CONSTEXPR int someInterface() { return 42; }
|
# ClimbingStats_CONSTEXPR int someInterface() { return 42; }
|
||||||
# };
|
# };
|
||||||
#
|
#
|
||||||
# The ``ClimbingStats_DECL_CXX_FINAL`` macro will expand to ``final`` if the
|
# The ``ClimbingStats_FINAL`` macro will expand to ``final`` if the
|
||||||
# compiler (and its flags) support the ``cxx_final`` feature, and the
|
# compiler (and its flags) support the ``cxx_final`` feature, and the
|
||||||
# ``ClimbingStats_DECL_CXX_CONSTEXPR`` macro will expand to ``constexpr``
|
# ``ClimbingStats_CONSTEXPR`` macro will expand to ``constexpr``
|
||||||
# if ``cxx_constexpr`` is supported.
|
# if ``cxx_constexpr`` is supported.
|
||||||
#
|
#
|
||||||
# The following features generate corresponding symbol defines:
|
# The following features generate corresponding symbol defines:
|
||||||
|
@ -386,7 +386,7 @@ function(write_compiler_detection_header
|
||||||
\n")
|
\n")
|
||||||
endif()
|
endif()
|
||||||
if (feature STREQUAL cxx_constexpr)
|
if (feature STREQUAL cxx_constexpr)
|
||||||
set(def_value "${prefix_arg}_DECL_${feature_upper}")
|
set(def_value "${prefix_arg}_CONSTEXPR")
|
||||||
set(file_content "${file_content}
|
set(file_content "${file_content}
|
||||||
# if ${def_name}
|
# if ${def_name}
|
||||||
# define ${def_value} constexpr
|
# define ${def_value} constexpr
|
||||||
|
@ -396,7 +396,7 @@ function(write_compiler_detection_header
|
||||||
\n")
|
\n")
|
||||||
endif()
|
endif()
|
||||||
if (feature STREQUAL cxx_final)
|
if (feature STREQUAL cxx_final)
|
||||||
set(def_value "${prefix_arg}_DECL_${feature_upper}")
|
set(def_value "${prefix_arg}_FINAL")
|
||||||
set(file_content "${file_content}
|
set(file_content "${file_content}
|
||||||
# if ${def_name}
|
# if ${def_name}
|
||||||
# define ${def_value} final
|
# define ${def_value} final
|
||||||
|
@ -406,7 +406,7 @@ function(write_compiler_detection_header
|
||||||
\n")
|
\n")
|
||||||
endif()
|
endif()
|
||||||
if (feature STREQUAL cxx_override)
|
if (feature STREQUAL cxx_override)
|
||||||
set(def_value "${prefix_arg}_DECL_${feature_upper}")
|
set(def_value "${prefix_arg}_OVERRIDE")
|
||||||
set(file_content "${file_content}
|
set(file_content "${file_content}
|
||||||
# if ${def_name}
|
# if ${def_name}
|
||||||
# define ${def_value} override
|
# define ${def_value} override
|
||||||
|
|
Loading…
Reference in New Issue