From f1c6fc8b6d7c19aa7ddcb8a21d7ac95d11e8ac9b Mon Sep 17 00:00:00 2001 From: rppicomidi <94197396+rppicomidi@users.noreply.github.com> Date: Tue, 16 Jan 2024 07:43:57 -0800 Subject: [PATCH] Fix #1442: Allow adding alternative .gatt file import paths (#1445) * fix feature request #1442 * Do not require -I before each addtional path * Fix pico_btstack_make_gatt_header warning gatt header files are always made into the "generated" folder so you get a warning if you have more than one target generating a gatt header with the same name. Also, simplify the expansion of ARGN * Improve pico_btstack_make_gatt_header description --------- Co-authored-by: Peter Harper --- src/rp2_common/pico_btstack/CMakeLists.txt | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/rp2_common/pico_btstack/CMakeLists.txt b/src/rp2_common/pico_btstack/CMakeLists.txt index 6ead74ddc..9cf6f28ef 100644 --- a/src/rp2_common/pico_btstack/CMakeLists.txt +++ b/src/rp2_common/pico_btstack/CMakeLists.txt @@ -232,21 +232,22 @@ if (EXISTS ${PICO_BTSTACK_PATH}/${BTSTACK_TEST_PATH}) # Make a GATT header file from a BTstack GATT file # Pass the target library name library type and path to the GATT input file + # To add additional directories to the gatt #import path, add them to the end of the argument list. function(pico_btstack_make_gatt_header TARGET_LIB TARGET_TYPE GATT_FILE) find_package (Python3 REQUIRED COMPONENTS Interpreter) get_filename_component(GATT_NAME "${GATT_FILE}" NAME_WE) get_filename_component(GATT_PATH "${GATT_FILE}" PATH) - set(GATT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated") - set(GATT_HEADER "${GATT_BINARY_DIR}/${GATT_NAME}.h") set(TARGET_GATT "${TARGET_LIB}_gatt_header") - + set(GATT_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/generated/${TARGET_GATT}") + set(GATT_HEADER "${GATT_BINARY_DIR}/${GATT_NAME}.h") + list(TRANSFORM ARGN PREPEND "-I") add_custom_target(${TARGET_GATT} DEPENDS ${GATT_HEADER}) add_custom_command( OUTPUT ${GATT_HEADER} DEPENDS ${GATT_FILE} WORKING_DIRECTORY ${GATT_PATH} COMMAND ${CMAKE_COMMAND} -E make_directory ${GATT_BINARY_DIR} && - ${Python3_EXECUTABLE} ${PICO_SDK_PATH}/lib/btstack/tool/compile_gatt.py ${GATT_FILE} ${GATT_HEADER} + ${Python3_EXECUTABLE} ${PICO_SDK_PATH}/lib/btstack/tool/compile_gatt.py ${GATT_FILE} ${GATT_HEADER} ${ARGN} VERBATIM) add_dependencies(${TARGET_LIB} ${TARGET_GATT}