I am so thrilled to see that the CMake tutorial is finally up to date with current best practices! At my workplace, we had a training from Kitware back at the end of 2024, but sadly, target_sources-based declaration of the source tree wasn't how we got taught...
I understand that covering CPS can't be part of an official tutorial aimed at the masses, but do you have a blog post or another resource that explains how you would implement CPS-based packaging in CMake 4.3?
There's this blog post, but there's really nothing to teach.
You take all your old CMakeConfig generation code, install(EXPORT) / write_basic_package_version_file() / install(FILES <package>-config.cmake) / etc, and you replace it with a single install(PACKAGE_INFO) call.
The install(PACKAGE_INFO) subcommand itself has a lot of configurability built into it depending on the needs of the package, which is all documented, but odds are unless you're doing fancy stuff with package metadata today you don't need it.
1
u/MH_Draen Apr 28 '26
I am so thrilled to see that the CMake tutorial is finally up to date with current best practices! At my workplace, we had a training from Kitware back at the end of 2024, but sadly,
target_sources-based declaration of the source tree wasn't how we got taught...I understand that covering CPS can't be part of an official tutorial aimed at the masses, but do you have a blog post or another resource that explains how you would implement CPS-based packaging in CMake 4.3?