diff options
author | Friedrich W. H. Kossebau <kossebau@kde.org> | 2019-09-04 19:19:27 +0200 |
---|---|---|
committer | Friedrich W. H. Kossebau <kossebau@kde.org> | 2019-10-10 22:50:03 +0200 |
commit | 7b15c20dafc9133f93bbc65354ec3a36af168fd3 (patch) | |
tree | b61228f0bfb4cc4a50c70ccce67a69b273dc8d10 /tests/ECMGenerateExportHeaderTest/consumer/CMakeLists.txt | |
parent | f3f4893b5bd20a32dd48b147fdd243c3226a06f3 (diff) | |
download | extra-cmake-modules-7b15c20dafc9133f93bbc65354ec3a36af168fd3.tar.gz extra-cmake-modules-7b15c20dafc9133f93bbc65354ec3a36af168fd3.tar.bz2 |
Add ECMGenerateExportHeader, for improved handling of deprecated API
Summary:
Generates additional macros in the export header which can be used for
fine-grained disabling of warnings & visibility as well as excluding from
the build.
Reviewers: #frameworks, #build_system
Subscribers: chehrlic, dfaure, cgiboudeaux, kde-frameworks-devel, kde-buildsystem
Tags: #frameworks, #build_system
Differential Revision: https://phabricator.kde.org/D23789
Diffstat (limited to 'tests/ECMGenerateExportHeaderTest/consumer/CMakeLists.txt')
-rw-r--r-- | tests/ECMGenerateExportHeaderTest/consumer/CMakeLists.txt | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/tests/ECMGenerateExportHeaderTest/consumer/CMakeLists.txt b/tests/ECMGenerateExportHeaderTest/consumer/CMakeLists.txt new file mode 100644 index 00000000..ba5940cd --- /dev/null +++ b/tests/ECMGenerateExportHeaderTest/consumer/CMakeLists.txt @@ -0,0 +1,50 @@ +cmake_minimum_required(VERSION 3.0.0) + +project(consumer) + +include(CheckCXXSourceCompiles) +include(CMakeParseArguments) + +include(../../test_helpers.cmake) + +include("${CMAKE_CURRENT_BINARY_DIR}/../installation/${LIBRARY}/lib/library/LibraryTargets.cmake") + +# map any "CURRENT" value to library version string +# keep version in sync with the one used in library/CMakeLists.txt +set(library_version 2.40.0) +if(LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT STREQUAL "CURRENT") + set(LIBRARY_DISABLE_DEPRECATED_BEFORE_AND_AT ${library_version}) +endif() +if(DEPRECATED_EXCLUDED_BEFORE_AND_AT STREQUAL "CURRENT") + set(DEPRECATED_EXCLUDED_BEFORE_AND_AT ${library_version}) +endif() + +# load the test variant specific testAPI method +include(testAPI_${TEST_VARIANT}.cmake) + +# for each API element test their visibility to the compiler and if a warning is emitted +set(_code "Enum enumerator = Enumerator_deprecatedAt2_0;") +testAPI(_code DEPRECATED_AT 2.0 BUILD_TIME_ONLY_DISABLABLE NO_WARNING) + +set(_code "Enum enumerator = Enumerator_not_deprecated;") +testAPI(_code) + +set(_code "function_deprecatedAt2_0();") +testAPI(_code DEPRECATED_AT 2.0) + +set(_code "function_deprecatedAt2_12();") +testAPI(_code DEPRECATED_AT 2.12) + +set(_code "function_not_deprecated();") +testAPI(_code) + +set(_code "Class().method_deprecatedAt2_0();") +testAPI(_code DEPRECATED_AT 2.0 BUILD_TIME_ONLY_DISABLABLE) + +set(_code "Class().method_deprecatedAt2_12();") +testAPI(_code DEPRECATED_AT 2.12 BUILD_TIME_ONLY_DISABLABLE) + +set(_code "Class().method_not_deprecated();") +testAPI(_code) + +add_executable(dummy main.cpp) |