From 1e301371090ad01bc41ad51393fd87a1db09becd Mon Sep 17 00:00:00 2001 From: John Ericson Date: Mon, 21 Oct 2024 12:06:05 -0400 Subject: [PATCH] doc: Improve CMake setup hook docs, following Meson's See also #342868 --- doc/hooks/cmake.section.md | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/doc/hooks/cmake.section.md b/doc/hooks/cmake.section.md index b5dc5a914434..5bcc3c980fc5 100644 --- a/doc/hooks/cmake.section.md +++ b/doc/hooks/cmake.section.md @@ -1,3 +1,35 @@ # cmake {#cmake} -Overrides the default configure phase to run the CMake command. By default, we use the Make generator of CMake. In addition, dependencies are added automatically to `CMAKE_PREFIX_PATH` so that packages are correctly detected by CMake. Some additional flags are passed in to give similar behavior to configure-based packages. You can disable this hook’s behavior by setting `configurePhase` to a custom value, or by setting `dontUseCmakeConfigure`. `cmakeFlags` controls flags passed only to CMake. By default, parallel building is enabled as CMake supports parallel building almost everywhere. When Ninja is also in use, CMake will detect that and use the ninja generator. +Overrides the default configure phase to run the CMake command. + +By default, we use the Make generator of CMake. +But when Ninja is also available as a `nativeBuildInput`, this setup hook will detect that and use the ninja generator. + +Dependencies are added automatically to `CMAKE_PREFIX_PATH` so that packages are correctly detected by CMake. +Some additional flags are passed in to give similar behavior to configure-based packages. + +By default, parallel building is enabled as CMake supports parallel building almost everywhere. + +You can disable this hook’s behavior by setting `configurePhase` to a custom value, or by setting `dontUseCmakeConfigure`. + +## Variables controlling CMake {#cmake-variables-controlling} + +### CMake Exclusive Variables {#cmake-exclusive-variables} + +#### `cmakeFlags` {#cmake-flags} + +Controls the flags passed to `cmake setup` during configure phase. + +#### `cmakeBuildDir` {#cmake-build-dir} + +Directory where CMake will put intermediate files. + +Setting this can be useful for debugging multiple CMake builds while in the same source directory, for example, when building for different platforms. +Different values for each build will prevent build artefacts from interefering with each other. +This setting has no tangible effect when running the build in a sandboxed derivation. + +The default value is `build`. + +#### `dontUseCmakeConfigure` {#dont-use-cmake-configure} + +When set to true, don't use the predefined `cmakeConfigurePhase`.