zephyr/cmake/bintools/gnu/target.cmake
Stephanos Ioannidis 3181331586 cmake: bintools: gnu: Suppress GDB check console outputs
The GDB check routine added in the PR #38749 does not suppress the
console outputs (stdout and stderr) and may print out a misleading
error message during a CMake configuration when the required version
of Python is not available on the system:

  arm-zephyr-eabi-gdb: error while loading shared libraries:
  libpython3.8.so.1.0: cannot open shared object file: No such file or
  directory

This commit adds the `OUTPUT_QUIET` and `ERROR_QUIET` options when
executing the GDB process so that the console outputs during the GDB
executable validation are not displayed to the user.

In addition, this commit removes the unused `GDB_PY_NO_PY` standard
output redirection variable since it is unnecessary.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-01-10 09:38:41 -06:00

36 lines
1.5 KiB
CMake

# SPDX-License-Identifier: Apache-2.0
# Configures binary tools as GNU binutils
find_program(CMAKE_OBJCOPY ${CROSS_COMPILE}objcopy PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_OBJDUMP ${CROSS_COMPILE}objdump PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_AS ${CROSS_COMPILE}as PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_AR ${CROSS_COMPILE}ar PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_RANLIB ${CROSS_COMPILE}ranlib PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_READELF ${CROSS_COMPILE}readelf PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_NM ${CROSS_COMPILE}nm PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_STRIP ${CROSS_COMPILE}strip PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
find_program(CMAKE_GDB ${CROSS_COMPILE}gdb PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
if(CMAKE_GDB)
execute_process(
COMMAND ${CMAKE_GDB} --configuration
RESULTS_VARIABLE GDB_CFG_ERR
OUTPUT_QUIET
ERROR_QUIET
)
if (${GDB_CFG_ERR})
# Failed to execute GDB, likely because of Python deps
find_program(CMAKE_GDB_NO_PY ${CROSS_COMPILE}gdb-no-py PATHS ${TOOLCHAIN_HOME} NO_DEFAULT_PATH)
if (CMAKE_GDB_NO_PY)
set(CMAKE_GDB ${CMAKE_GDB_NO_PY} CACHE FILEPATH "Path to a program." FORCE)
endif()
endif()
endif()
find_program(CMAKE_GDB gdb-multiarch PATHS ${TOOLCHAIN_HOME} )
# Include bin tool properties
include(${ZEPHYR_BASE}/cmake/bintools/gnu/target_bintools.cmake)