diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,13 +19,13 @@ set(REQUIRED_QT_VERSION 5.11.0) find_package(Qt5Core ${REQUIRED_QT_VERSION} REQUIRED NO_MODULE) - -include(GenerateExportHeader) - +include(ECMGenerateExportHeader) include(ECMSetupVersion) include(ECMGenerateHeaders) include(ECMAddQch) +set(EXCLUDE_DEPRECATED_BEFORE_AND_AT 0 CACHE STRING "Control the range of deprecated API excluded from the build [default=0].") + option(BUILD_QCH "Build API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)" OFF) add_feature_info(QCH ${BUILD_QCH} "API documentation in QCH format (for e.g. Qt Assistant, Qt Creator & KDevelop)") diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -35,8 +35,15 @@ ) add_library(KF5ThreadWeaver ${ThreadWeaver_LIB_SRCS}) -generate_export_header(KF5ThreadWeaver BASE_NAME ThreadWeaver) add_library(KF5::ThreadWeaver ALIAS KF5ThreadWeaver) +ecm_generate_export_header(KF5ThreadWeaver + BASE_NAME ThreadWeaver + # GROUP_BASE_NAME KF <- enable once all of KF modules use ecm_generate_export_header + VERSION ${KF5_VERSION} + DEPRECATED_BASE_VERSION 0 + DEPRECATION_VERSIONS 5.0 + EXCLUDE_DEPRECATED_BEFORE_AND_AT ${EXCLUDE_DEPRECATED_BEFORE_AND_AT} +) target_link_libraries(KF5ThreadWeaver PUBLIC Qt5::Core) set(threadweaver_BUILD_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/.. ${CMAKE_CURRENT_BINARY_DIR}) target_include_directories(KF5ThreadWeaver PUBLIC "$") diff --git a/src/collection.h b/src/collection.h --- a/src/collection.h +++ b/src/collection.h @@ -68,9 +68,11 @@ /** Return the number of elements in the collection. */ int elementCount() const; - //FIXME remove - /** @deprecated Use elementCount(). */ +#if THREADWEAVER_ENABLE_DEPRECATED_SINCE(5, 0) + /** @deprecated Since 5.0, use elementCount(). */ + THREADWEAVER_DEPRECATED_VERSION(5, 0, "Use Collection::elementCount()") int jobListLength() const; +#endif /** @brief Add the job to this collection by pointer. */ Collection &operator<<(ThreadWeaver::JobInterface *job); diff --git a/src/collection.cpp b/src/collection.cpp --- a/src/collection.cpp +++ b/src/collection.cpp @@ -180,11 +180,13 @@ } +#if THREADWEAVER_BUILD_DEPRECATED_SINCE(5, 0) int Collection::jobListLength() const { QMutexLocker l(mutex()); Q_UNUSED(l); return jobListLength_locked(); } +#endif int Collection::jobListLength_locked() const {