Set default GATT path to CMAKE_CURRENT_LIST_DIR if not specified (#2385)

This ensures the GATT_PATH variable is set to the calling directory when just a filename is provided with no path

Fixes #2366
This commit is contained in:
will-v-pi 2025-04-04 17:36:32 +01:00 committed by GitHub
parent c88bd53a68
commit 701c1933af
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -308,6 +308,9 @@ if (EXISTS ${PICO_BTSTACK_PATH}/${BTSTACK_TEST_PATH})
find_package (Python3 REQUIRED COMPONENTS Interpreter)
get_filename_component(GATT_NAME "${GATT_FILE}" NAME_WE)
get_filename_component(GATT_PATH "${GATT_FILE}" PATH)
if (NOT GATT_PATH)
set(GATT_PATH "${CMAKE_CURRENT_LIST_DIR}")
endif()
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")