ECM(7)

✨ ecm β€” Extra CMake Modules ✨

okay so bestie, welcome to ECM(7) β€” the manual page for the Extra CMake Modules package, aka ECM. this is the extra-cmake-modules manual, and it's lowkey iconic. let me tell you everything πŸ’…


πŸŽ€ INTRODUCTION πŸŽ€

The Extra CMake Modules package, or ECM, adds to the modules provided by CMake. it's giving "expansion pack" energy. what kind of modules, you ask? three whole vibes:

  • ones used by find_package() to find common software
  • ones that can be used directly in CMakeLists.txt files to perform common tasks
  • toolchain files that must be specified on the commandline by the user

In addition, it provides common build settings used in software produced by the KDE community. πŸ‘‘

So while the driving force of this module is to reduce duplication in CMake scripts across KDE software, it is intended to be useful for any software that uses the CMake build system. yes bestie, you too 🫢


🌸 USAGE 🌸

To use ECM, add the following to your CMakeLists.txt:

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})

(and ngl, you may want to append ${ECM_MODULE_PATH} to CMAKE_MODULE_PATH rather than discarding the existing value β€” literally don't throw away what's already there πŸ™ˆ). You can then just include the modules you require, or use find_package() as needed. like this:

include(ECMInstallIcons)

Developers of KDE software will often want to use the KDE standard settings provided by ECM; they can do the following:

find_package(ECM REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
include(KDEInstallDirs)
include(KDECompilerSettings)
include(KDECMakeSettings)

Note that any combination of the above includes can be used if you only want some of the settings β€” you don't have to take the whole bundle, bestie. and some of the functionality of KDECMakeSettings can also be selectively disabled. ✨

πŸ¦‹ Organization πŸ¦‹

ECM provides four different types of modules. four! a whole squad πŸ’–

  • Core modules provide helpful macros for use in project CMake scripts. See ecm-modules(7) for more information.
  • Find modules extend the functionality of CMake's find_package() command. See ecm-find-modules(7) for more information.
  • KDE modules provide common settings for software produced by KDE; much of this may also be useful to other projects. See ecm-kde-modules(7) for more information.
  • Toolchain files change the build tools and targets used by CMake. See ecm-toolchains(7) for more information.

The ${ECM_MODULE_DIR}, ${ECM_FIND_MODULE_DIR} and ${ECM_KDE_MODULE_DIR} variables may be used instead of ${ECM_MODULE_PATH} if you only need some of this functionality. so organized, so demure πŸŽ€


πŸ’œ DEVELOPMENT πŸ’œ

The ecm-developer(7) manual contains more information about developing for Extra CMake Modules. iykyk β€” if you're building on ECM instead of just using it, that's your next read πŸ‘‘


🌈 LICENSE 🌈

All code is licensed under the BSD 3-Clause license β€” https://opensource.org/licenses/BSD-3-Clause. periodt πŸ’…



ngl, the home page and the git repo are the same URL β€” not me noticing that twice πŸ‘€ that's what the original says and i'm not about to edit the source material, no cap.

Copyright KDE Developers 🫢

πŸŒΈπŸ’– and that's the whole page, bestie! sign-off time: this manual page is version 6.31, dated Oct 11, 2026, and yes it ate. go forth and find_package(ECM REQUIRED NO_MODULE) your heart out βœ¨πŸŽ€πŸ’…

πŸ“¦ where this page comes from