From 604f705fda149dea73e5fc830975e2ccefa994c8 Mon Sep 17 00:00:00 2001 From: Torsten Rasmussen Date: Fri, 17 Dec 2021 13:15:42 +0100 Subject: [PATCH] cmake: doc: created a doc.cmake CMake module in Zephyr CMake modules dir Creating a doc.cmake to the new Zephyr CMake modules dir. This removes the need for `set(NO_BOILERPLATE TRUE)` before loading the Zephyr CMake package. It also removes the need within the doc/CMakeLists.txt file to manually include individual parts of the Zephyr CMake files as this is now controlled through a single Zephyr CMake doc module. This aligns the way a Zephyr package is sourced with other places. Signed-off-by: Torsten Rasmussen --- cmake/modules/doc.cmake | 24 ++++++++++++++++++++++++ doc/CMakeLists.txt | 13 +------------ 2 files changed, 25 insertions(+), 12 deletions(-) create mode 100644 cmake/modules/doc.cmake diff --git a/cmake/modules/doc.cmake b/cmake/modules/doc.cmake new file mode 100644 index 0000000000..daf1633640 --- /dev/null +++ b/cmake/modules/doc.cmake @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: Apache-2.0 +# +# Copyright (c) 2021, Nordic Semiconductor ASA + +# This CMake module will load all Zephyr CMake modules required for a +# documentation build. +# +# The following CMake modules will be loaded: +# - extensions +# - python +# - west +# - root +# - zephyr_module +# +# Outcome: +# The Zephyr package required for documentation build setup. + +include_guard(GLOBAL) + +include(extensions) +include(python) +include(west) +include(root) +include(zephyr_module) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 2140a7338c..ed03b4bb49 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -3,8 +3,7 @@ cmake_minimum_required(VERSION 3.20.0) project(Zephyr-Kernel-Doc LANGUAGES) -set(NO_BOILERPLATE TRUE) -find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} ..) +find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} .. COMPONENTS doc) file(TO_CMAKE_PATH "${ZEPHYR_BASE}" ZEPHYR_BASE) message(STATUS "Zephyr base: ${ZEPHYR_BASE}") @@ -37,11 +36,6 @@ if(NOT LATEX_PDFLATEX_FOUND OR NOT LATEXMK) message(WARNING "LaTeX components not found. PDF build will not be available.") endif() -include(${ZEPHYR_BASE}/cmake/python.cmake) - -# Find west to (optionally) process modules for Kconfig -find_program(WEST west) - #------------------------------------------------------------------------------- # Environment & Paths @@ -104,11 +98,6 @@ set_target_properties( # kconfig set(KCONFIG_BINARY_DIR ${CMAKE_BINARY_DIR}/Kconfig) -list(INSERT MODULE_EXT_ROOT 0 ${ZEPHYR_BASE}) -file(MAKE_DIRECTORY ${KCONFIG_BINARY_DIR}) - -include(${ZEPHYR_BASE}/cmake/extensions.cmake) -include(${ZEPHYR_BASE}/cmake/zephyr_module.cmake) foreach(module_name ${ZEPHYR_MODULE_NAMES}) zephyr_string(SANITIZE TOUPPER MODULE_NAME_UPPER ${module_name})