aboutsummaryrefslogtreecommitdiff
path: root/tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt
diff options
context:
space:
mode:
authorFriedrich W. H. Kossebau <kossebau@kde.org>2019-09-04 19:19:27 +0200
committerFriedrich W. H. Kossebau <kossebau@kde.org>2019-10-10 22:50:03 +0200
commit7b15c20dafc9133f93bbc65354ec3a36af168fd3 (patch)
treeb61228f0bfb4cc4a50c70ccce67a69b273dc8d10 /tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt
parentf3f4893b5bd20a32dd48b147fdd243c3226a06f3 (diff)
downloadextra-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/library/CMakeLists.txt')
-rw-r--r--tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt40
1 files changed, 40 insertions, 0 deletions
diff --git a/tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt b/tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt
new file mode 100644
index 00000000..eb925c9b
--- /dev/null
+++ b/tests/ECMGenerateExportHeaderTest/library/CMakeLists.txt
@@ -0,0 +1,40 @@
+cmake_minimum_required(VERSION 3.0.0)
+
+# keep version in sync with the one used in consumer/CMakeLists.txt for the library
+# ideally would be send over by an exported target property,
+# but exporting custom properties via EXPORT_PROPERTIES only was added in CMake 3.12
+project(library VERSION 2.40.0)
+
+set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/../../../modules)
+include(ECMGenerateExportHeader)
+
+set(_public_includedir "include/library")
+
+add_library(library library.cpp)
+target_include_directories(library
+ PUBLIC
+ "$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}>"
+ "$<INSTALL_INTERFACE:${_public_includedir}>"
+)
+
+if(SET_GROUP)
+ set(_group_args GROUP_BASE_NAME LIBGROUP)
+endif()
+
+ecm_generate_export_header(library
+ ${_group_args}
+ VERSION ${library_VERSION}
+ DEPRECATION_VERSIONS 2.0 2.12
+ EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT}
+)
+
+install(TARGETS library DESTINATION lib EXPORT library_targets)
+
+install(EXPORT library_targets FILE LibraryTargets.cmake DESTINATION lib/library)
+install(FILES
+ library.hpp
+ "${CMAKE_CURRENT_BINARY_DIR}/library_export.h"
+ DESTINATION ${_public_includedir}
+)
+
+add_executable(dummy main.cpp)