zephyr/cmake/usage/CMakeLists.txt
Torsten Rasmussen ad1fecc950 cmake: ninja usage build target
Fixed usage build target.

Previously, `ninja usage` would print:
Build flags:

  ninja VERBOSE=1 [targets] verbose build

This is clearly wrong, as VERBOSE=1 is for make targets.

To support both ninja based builds and make based build systems, the
CMAKE_MAKE_PROGRAM is now exported from the calling CMake / build
instance, and the verbose flag is set depending on whether ninja or
make is used as build program.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
2020-03-27 16:23:46 +01:00

18 lines
564 B
CMake

# SPDX-License-Identifier: Apache-2.0
string(REPLACE ";" " " BOARD_ROOT_SPACE_SEPARATED "${BOARD_ROOT}")
string(REPLACE ";" " " SHIELD_LIST_SPACE_SEPARATED "${SHIELD_LIST}")
add_custom_target(
usage
${CMAKE_COMMAND}
-DZEPHYR_BASE=${ZEPHYR_BASE}
-DBOARD_ROOT_SPACE_SEPARATED=${BOARD_ROOT_SPACE_SEPARATED}
-DSHIELD_LIST_SPACE_SEPARATED=${SHIELD_LIST_SPACE_SEPARATED}
-DCMAKE_MAKE_PROGRAM=${CMAKE_MAKE_PROGRAM}
-P ${CMAKE_CURRENT_SOURCE_DIR}/usage.cmake
)
# NB: The reason it is 'usage' and not help is that CMake already
# defines a target 'help'