diff --git a/port/libusb/CMakeLists.txt b/port/libusb/CMakeLists.txt index eada67bcb..094cbef07 100644 --- a/port/libusb/CMakeLists.txt +++ b/port/libusb/CMakeLists.txt @@ -181,11 +181,13 @@ set (LWIP_EXAMPLES pan_lwip_http_server) # create targets foreach(EXAMPLE_FILE ${EXAMPLES_C}) get_filename_component(EXAMPLE ${EXAMPLE_FILE} NAME_WE) - set (SOURCE_FILES ${EXAMPLE_FILE}) + + # get c file + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add lwip sources for lwip examples if ( "${LWIP_EXAMPLES}" MATCHES ${EXAMPLE} ) - list(APPEND SOURCE_FILES ${SOURCES_LWIP}) + list(APPEND SOURCES_EXAMPLE ${SOURCES_LWIP}) endif() # add GATT DB creation @@ -197,10 +199,10 @@ foreach(EXAMPLE_FILE ${EXAMPLES_C}) COMMAND ${Python_EXECUTABLE} ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h ) - list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h) + list(APPEND SOURCES_EXAMPLE ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${SOURCE_FILES} ) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE} ) target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE_FILE) diff --git a/port/posix-h4-zephyr/CMakeLists.txt b/port/posix-h4-zephyr/CMakeLists.txt index 9edaf0df4..9c74a1985 100644 --- a/port/posix-h4-zephyr/CMakeLists.txt +++ b/port/posix-h4-zephyr/CMakeLists.txt @@ -97,15 +97,14 @@ include(../../example/CMakeLists.txt) set (EXAMPLES ${EXAMPLES_LE_ONLY} ${EXAMPLES_GENERAL}) # create targets -set (EXAMPLES_C) foreach(EXAMPLE ${EXAMPLES}) # get c file - file(GLOB EXAMPLE_FILE "../../example/${EXAMPLE}.c") + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add GATT DB creation if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) message("example ${EXAMPLE} -- with GATT DB") - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt COMMAND ${Python_EXECUTABLE} @@ -115,6 +114,6 @@ foreach(EXAMPLE ${EXAMPLES}) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${EXAMPLE_FILE} ) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE) diff --git a/port/posix-h4/CMakeLists.txt b/port/posix-h4/CMakeLists.txt index dd6b8b715..88e29e9c2 100644 --- a/port/posix-h4/CMakeLists.txt +++ b/port/posix-h4/CMakeLists.txt @@ -166,13 +166,11 @@ list(REMOVE_ITEM EXAMPLES "mesh_node_demo") # create targets foreach(EXAMPLE ${EXAMPLES}) # get c file - file(GLOB EXAMPLE_FILE "${BTSTACK_ROOT}/example/${EXAMPLE}.c") - set (SOURCE_FILES ${EXAMPLE_FILE}) + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add GATT DB creation if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) message("example ${EXAMPLE} -- with GATT DB") - message("${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h <- ${Python_EXECUTABLE} ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h") add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt @@ -183,6 +181,6 @@ foreach(EXAMPLE ${EXAMPLES}) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${SOURCE_FILES} ) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE) diff --git a/port/windows-h4-da14585/CMakeLists.txt b/port/windows-h4-da14585/CMakeLists.txt index 2a373ce31..5a0eff09e 100644 --- a/port/windows-h4-da14585/CMakeLists.txt +++ b/port/windows-h4-da14585/CMakeLists.txt @@ -77,21 +77,21 @@ list(REMOVE_ITEM EXAMPLES "mesh_node_demo") # create targets foreach(EXAMPLE ${EXAMPLES}) # get c file - file(GLOB EXAMPLE_FILE "../../example/${EXAMPLE}.c") + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add GATT DB creation if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) message("example ${EXAMPLE} -- with GATT DB") - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h - DEPENDS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt - COMMAND ${CMAKE_SOURCE_DIR}/../../tool/compile_gatt.py - ARGS ${CMAKE_SOURCE_DIR}/../../example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h + DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt + COMMAND ${Python_EXECUTABLE} + ARGS ${BTSTACK_ROOT}/tool/compile_gatt.py ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h ) list(APPEND SOURCE_FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${EXAMPLE_FILE} ) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE) diff --git a/port/windows-h4-zephyr/CMakeLists.txt b/port/windows-h4-zephyr/CMakeLists.txt index 79e7f0fa2..42852d4eb 100644 --- a/port/windows-h4-zephyr/CMakeLists.txt +++ b/port/windows-h4-zephyr/CMakeLists.txt @@ -77,12 +77,12 @@ list(REMOVE_ITEM EXAMPLES "mesh_node_demo") # create targets foreach(EXAMPLE ${EXAMPLES}) # get c file - file(GLOB EXAMPLE_FILE "../../example/${EXAMPLE}.c") + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add GATT DB creation if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) message("example ${EXAMPLE} -- with GATT DB") - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt COMMAND ${Python_EXECUTABLE} @@ -92,6 +92,6 @@ foreach(EXAMPLE ${EXAMPLES}) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${EXAMPLE_FILE} ) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE) diff --git a/port/windows-h4/CMakeLists.txt b/port/windows-h4/CMakeLists.txt index 52796d486..dfa901363 100644 --- a/port/windows-h4/CMakeLists.txt +++ b/port/windows-h4/CMakeLists.txt @@ -167,13 +167,12 @@ list(REMOVE_ITEM EXAMPLES "mesh_node_demo") # create targets foreach(EXAMPLE ${EXAMPLES}) # get c file - file(GLOB EXAMPLE_FILE "${BTSTACK_ROOT}/example/${EXAMPLE}.c") - set (SOURCE_FILES ${EXAMPLE_FILE}) + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add GATT DB creation if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) message("example ${EXAMPLE} -- with GATT DB") - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt COMMAND ${Python_EXECUTABLE} @@ -183,6 +182,6 @@ foreach(EXAMPLE ${EXAMPLES}) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${SOURCE_FILES} ) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE) diff --git a/port/windows-winusb/CMakeLists.txt b/port/windows-winusb/CMakeLists.txt index 3c3e2896e..faf89dc58 100644 --- a/port/windows-winusb/CMakeLists.txt +++ b/port/windows-winusb/CMakeLists.txt @@ -85,15 +85,14 @@ list(REMOVE_DUPLICATES EXAMPLES) list(REMOVE_ITEM EXAMPLES "mesh_node_demo") # create targets -set (EXAMPLES_C) foreach(EXAMPLE ${EXAMPLES}) # get c file - file(GLOB EXAMPLE_FILE "../../example/${EXAMPLE}.c") + set (SOURCES_EXAMPLE ${BTSTACK_ROOT}/example/${EXAMPLE}.c) # add GATT DB creation if ( "${EXAMPLES_GATT_FILES}" MATCHES ${EXAMPLE} ) message("example ${EXAMPLE} -- with GATT DB") - add_custom_command( + add_custom_command( OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXAMPLE}.h DEPENDS ${BTSTACK_ROOT}/example/${EXAMPLE}.gatt COMMAND ${Python_EXECUTABLE} @@ -103,6 +102,6 @@ foreach(EXAMPLE ${EXAMPLES}) else() message("example ${EXAMPLE}") endif() - add_executable(${EXAMPLE} ${EXAMPLE_FILE} ) - target_link_libraries(${EXAMPLE} btstack setupapi winusb) + add_executable(${EXAMPLE} ${SOURCES_EXAMPLE}) + target_link_libraries(${EXAMPLE} btstack) endforeach(EXAMPLE)