Draft: Add ECMInstalledLibraryCheck

WORKING PRODUCT-LIKE PROTOTYPE: feedback/collaboration wanted, especially for integration in people's workflows :)

About

ECMInstalledLibraryCheck adds a macro to add checks for the installed library artifacts, from consumer POV. Currently checks public headers (includability) & CMake config files (proper data delivery needed for compiling)

Adds one global target all_installed_library_check, to run the checks for all libraries, and a target per library, <library_target>_installed_library_check. Targets to be used after installation.

See the docs in the MR code for more details.

Example usages (see kio!2236):

include(ECMInstalledLibraryCheck)

ecm_add_installed_library_check(KF6KIOCore
    PACKAGE_NAME "KF6KIO"
    PACKAGE_VERSION ${KIO_VERSION}
    PACKAGE_TARGET_NAMESPACE "KF6::"
)

# adding headers for <KFoo> includes
ecm_installed_library_check_include_strings(KF6KIOCore
    HEADERS ${KIOCore_CamelCase_HEADERS}
)

# adding headers for <Prefix/Foo> includes
ecm_installed_library_check_include_strings(KF6KIOCore
    HEADERS ${KIOCore_Namespaced_CamelCase_HEADERS}
    PREFIX KIO
)

Already has been (locally) used on all KF modules and further library projects, and resulted in some fixes already rolled out. It has found things like in headers missing includes for self-containedness, broken relative includes, for CMake config files missing dependency checks and missing public linking of libraries.

Targetting ECM 6.29.

Open questions

  • support wanted for multiple variants, e.g. testing different compile-time options?
  • How to integrate into automated testing, given it can be done only post-install?
  • What to do with header-only includes which have additional deps (KRunner/AbstractTestRunner, KQuickIconProvider, ...)?
  • cross-compilation, how/if (or in general with a CMAKE_TOOLCHAIN_FILE, cmp. Gentoo build setup)

Some notes on "integrate into automated testing":
KF modules on CI all have tests run before installation, as they already had been handled for the idea of "Running apps uninstalled" (though tests linked seem to prefer any installed ones, some RPATH issue).
CMake only has the concept of one set of tests. One can filter the tests to run by name, that would need some naming pattern to strictly follow, to separate between pre-install and post-install.

Deployment

First MRs for KF:

Edited by Friedrich W. H. Kossebau

Merge request reports

Loading