Hi,

how would you feel if there is an option to automatically test the C++ 
library development artifacts (headers, CMake config, etc.) in their 
installed variant for usability, before other developers get to use them?

If that sounds somewhere interesting to you, read on :)

Possibly you also have already heard of this, there is currently some on-
going effort to develop a system for post-installation C++ library checks,
by the implementation name ECMInstalledLibraryCheck. While already in some 
usable state and there-by successfully having uncovered a number of issues, 
it is based only on a few people's needs & ideas, without any known similar 
solutions to be "inspired" from for features and patterns.


YOUR INPUT & COLLABORATION IS VERY WANTED

What are your pain points with installed C++ library artifacts you wish that 
would be tested (and which cannot be tested uninstalled)? What problems have 
you seen?

What similar solutions do exist already, for comparison & inspiration?

Would you have fun working on integrating such checks into KDE CI?

Have you tried the current prototype of ECMInstalledLibraryCheck on your 
library, what issues did you detect in your library, what features would you 
like in the check? (if not yet, see blog post linked below how to do)

Special question: have you seen public preprocessor definitions whose values 
depends on the build which only are defined with some library headers?


SMALL PEAK INTO PROTOTYPE FUNCTIONALITY

To get an idea on the current approach with ECMInstalledLibraryCheck, the 
checks are added by declaring them via such functions (by the example of 
KContacts):

--- 8< ---
# use the module from ECM
include(ECMInstalledLibraryCheck)
# for the library target KF6Contacts set up the check
ecm_add_installed_library_check(KF6Contacts
    PACKAGE_NAME "KF6Contacts"
    PACKAGE_VERSION ${KCONTACTS_VERSION}
    PACKAGE_TARGET_NAMESPACE "KF6::"
)
# register the official include statements for the check
ecm_installed_library_check_include_strings(KF6Contacts
    HEADERS ${KContacts_CamelCase_HEADERS}
    PREFIX KContacts
)
--- 8< ---

Further checks on certain aspects can be added by functions like 
ecm_installed_library_check_cmake_variable(), 
ecm_installed_library_check_compile_definition() and 
ecm_installed_library_check_preprocessor_macro(). Already there is a 
convenience variant of the last:
--- 8< ---
# check all includes also have the usual version macros defined afterwards
ecm_installed_library_check_version_preprocessor_macros(KF6Contacts
    PREFIX KCONTACTS
    VERSION ${KCONTACTS_VERSION}
    SILENT # only report errors
)
--- 8< ---

The check on the library then will appear as global build system target 
"all_installed_library_check", as well as variants per library.


MORE INFO

Find the merge request of ECMInstalledLibraryCheck here:
https://invent.kde.org/frameworks/extra-cmake-modules/-/merge_requests/590

A longer blog post going into details, also how to test-drive the check:
https://frinring.wordpress.com/2026/06/30/c-library-headers-cmake-config-files-are-we-serviceable/


TRY IT, COMMENT IT

Be very invited to shape this installed library check solution, so it can be 
useful to you right from the its first release.
Give it 15 minutes now for some considerations & feedback, and hopefully 
save many more minutes in the future :)

Hope to hear from you (even just a "want-this" or "useless-because"),
and thanks to those who already contributed.

Cheers
Friedrich


Reply via email to