KDECMakeSettings — Extra CMake Modules 5.21.0 documentation

# KDECMakeSettings

Changes various CMake settings to what the KDE community views as more sensible defaults.

It is recommended to include this module with the NO_POLICY_SCOPE flag, otherwise you may get spurious warnings with some versions of CMake.

It is split into three parts, which can be independently disabled if desired.

## Runtime Paths

The default runtime path (used on Unix systems to search for dynamically-linked libraries) is set to include the location that libraries will be installed to (as set in LIB_INSTALL_DIR), and also the linker search path.

Note that `LIB_INSTALL_DIR` needs to be set before including this module. Typically, this is done by including the `KDEInstallDirs` module.

This section can be disabled by setting `KDE_SKIP_RPATH_SETTINGS` to TRUE before including this module.

## Testing

Testing is enabled by default, and an option (BUILD_TESTING) is provided for users to control this. See the CTest module documentation in the CMake manual for more details.

This section can be disabled by setting `KDE_SKIP_TEST_SETTINGS` to TRUE before including this module.

## Build Settings

Various CMake build defaults are altered, such as searching source and build directories for includes first and enabling automoc by default.

This section can be disabled by setting `KDE_SKIP_BUILD_SETTINGS` to TRUE before including this module.

This section also provides an “uninstall” target that can be individually disabled by setting `KDE_SKIP_UNINSTALL_TARGET` to TRUE before including this module.

By default on OS X, X11 and XCB related detections are disabled. However if the need would arise to use these technologies, the detection can be enabled by setting `APPLE_FORCE_X11` to `ON`.

A warning is printed for the developer to know that the detection is disabled on OS X. This message can be turned off by setting `APPLE_SUPPRESS_X11_WARNING` to `ON`.

Since pre-1.0.0.

`ENABLE_CLAZY` option is added (OFF by default) when clang is being used. Turning this option on will force clang to load the clazy plugins for richer warnings on Qt-related code.

If clang is not being used, this won’t have an effect. See https://quickgit.kde.org/?p=clazy.git&a=blob&f=README&o=plain

Since 5.17.0

- Uninstall target functionality since 1.7.0.
- `APPLE_FORCE_X11` option since 5.14.0 (detecting X11 was previously the default behavior)
- `APPLE_SUPPRESS_X11_WARNING` option since 5.14.0