diff options
author | Friedrich W. H. Kossebau <kossebau@kde.org> | 2021-05-07 04:07:29 +0200 |
---|---|---|
committer | Friedrich W. H. Kossebau <kossebau@kde.org> | 2021-05-07 04:07:29 +0200 |
commit | bf5269dfdd94d63d72eb7725f1d3ea3d270d034d (patch) | |
tree | eda97c66a549fcd92a42eb6f78bcd2df05dbbd59 | |
parent | 77e9318d5245c6782e4381699d6f485876e8e9cd (diff) | |
download | extra-cmake-modules-bf5269dfdd94d63d72eb7725f1d3ea3d270d034d.tar.gz extra-cmake-modules-bf5269dfdd94d63d72eb7725f1d3ea3d270d034d.tar.bz2 |
Order macro for attribute for symbol export before that for deprecated
The symbol export/visibility attribute is not standardized so far and
needs to be set by language extension attribute declaration at least
with clang & MSVC, who both support that when it appears before the
standard attribute declaration.
NO_CHANGELOG
-rw-r--r-- | modules/ECMGenerateExportHeader.cmake | 12 | ||||
-rw-r--r-- | tests/ECMGenerateExportHeaderTest/library/library.hpp | 6 |
2 files changed, 12 insertions, 6 deletions
diff --git a/modules/ECMGenerateExportHeader.cmake b/modules/ECMGenerateExportHeader.cmake index f6646899..7cd1418e 100644 --- a/modules/ECMGenerateExportHeader.cmake +++ b/modules/ECMGenerateExportHeader.cmake @@ -216,16 +216,18 @@ this, using the generated macros ``FOO_ENABLE_DEPRECATED_SINCE`` and /** * @deprecated Since 5.0 */ + FOO_EXPORT FOO_DEPRECATED_VERSION(5, 0, "Use doFoo2()") - FOO_EXPORT void doFoo(); + void doFoo(); #endif #if FOO_ENABLE_DEPRECATED_SINCE(5, 12) /** * @deprecated Since 5.12 */ + FOO_EXPORT FOO_DEPRECATED_VERSION(5, 12, "Use doBar2()") - FOO_EXPORT void doBar(); + void doBar(); #endif Projects linking against the "Foo" library can control which part of its @@ -283,16 +285,18 @@ uses the generated macro ``FOO_BUILD_DEPRECATED_SINCE``, like this: /** * @deprecated Since 5.0 */ + FOO_EXPORT FOO_DEPRECATED_VERSION(5, 0, "Use doFoo2()") - FOO_EXPORT void doFoo(); + void doFoo(); #endif #if FOO_ENABLE_DEPRECATED_SINCE(5, 12) /** * @deprecated Since 5.12 */ + FOO_EXPORT FOO_DEPRECATED_VERSION(5, 12, "Use doBar2()") - FOO_EXPORT void doBar(); + void doBar(); #endif class FOO_EXPORT Foo { diff --git a/tests/ECMGenerateExportHeaderTest/library/library.hpp b/tests/ECMGenerateExportHeaderTest/library/library.hpp index 4afe87ac..4b9fc66a 100644 --- a/tests/ECMGenerateExportHeaderTest/library/library.hpp +++ b/tests/ECMGenerateExportHeaderTest/library/library.hpp @@ -11,13 +11,15 @@ enum Enum { }; #if LIBRARY_ENABLE_DEPRECATED_SINCE(2, 0) +LIBRARY_EXPORT LIBRARY_DEPRECATED_VERSION(2, 0, "Deprecated at 2.0") -LIBRARY_EXPORT void function_deprecatedAt2_0(); +void function_deprecatedAt2_0(); #endif #if LIBRARY_ENABLE_DEPRECATED_SINCE(2, 12) +LIBRARY_EXPORT LIBRARY_DEPRECATED_VERSION(2, 12, "Deprecated at 2.12") -LIBRARY_EXPORT void function_deprecatedAt2_12(); +void function_deprecatedAt2_12(); #endif LIBRARY_EXPORT void function_not_deprecated(); |