Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
- Removed `set(${VAR_NAME}_INCLUDES ${LIB_INCLUDES} PARENT_SCOPE)` from `setup_arduino_library` because it is automatically now,
  the `target_include_directories` on this function is in `PUBLIC` scope. Read more on:
  https://cmake.org/cmake/help/v3.0/command/target_include_directories.html
- Removed `set(${VAR_NAME}_INCLUDES ${LIB_INCLUDES} PARENT_SCOPE)` from `setup_arduino_libraries` cuzy the same... previous.
  • Loading branch information
denisacostaq committed Mar 21, 2017
1 parent 1dffec2 commit d76c9fb
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions cmake/Platform/Arduino.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -495,15 +495,17 @@ function(GENERATE_ARDUINO_FIRMWARE INPUT_NAME)
find_arduino_libraries(TARGET_LIBS "${ALL_SRCS}" "${INPUT_ARDLIBS}")
foreach(LIB_DEP ${TARGET_LIBS})
arduino_debug_msg("Arduino Library: ${LIB_DEP}")
# NOTE([email protected]): I prefer to remove this and use target_include_directories with INTERFACE scope.
set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} ${LIB_DEP}")
endforeach()

if(NOT INPUT_NO_AUTOLIBS)
setup_arduino_libraries(ALL_LIBS ${INPUT_BOARD} "${ALL_SRCS}" "${INPUT_ARDLIBS}" "" "" "${LIB_DEP_INCLUDES}")
foreach(LIB_INCLUDES ${ALL_LIBS_INCLUDES})
# NOTE([email protected]): I prefer remove this debug message because it is not error prone like before, see issue #170
foreach(LIB ${LIBS})
get_target_property(LIB_INCLUDES ${LIB} INCLUDE_DIRECTORIES)
arduino_debug_msg("Arduino Library Includes: ${LIB_INCLUDES}")
set(LIB_DEP_INCLUDES "${LIB_DEP_INCLUDES} ${LIB_INCLUDES}")
endforeach()
endforeach(LIB ${LIBS})
endif()

list(APPEND ALL_LIBS ${CORE_LIB} ${INPUT_LIBS})
Expand Down Expand Up @@ -962,7 +964,6 @@ set(Ethernet_RECURSE True)
set(SD_RECURSE True)
function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLAGS INCLUDE_PATHS)
set(LIB_TARGETS)
set(LIB_INCLUDES)

get_filename_component(LIB_NAME ${LIB_PATH} NAME)
set(TARGET_LIB_NAME ${BOARD_ID}_${LIB_NAME})
Expand All @@ -987,7 +988,6 @@ function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLA
foreach(LIB_DEP ${LIB_DEPS})
setup_arduino_library(DEP_LIB_SRCS ${BOARD_ID} ${LIB_DEP} "${COMPILE_FLAGS}" "${LINK_FLAGS} ${INCLUDE_PATHS}")
list(APPEND LIB_TARGETS ${DEP_LIB_SRCS})
list(APPEND LIB_INCLUDES ${DEP_LIB_SRCS_INCLUDES})
endforeach()

set_target_properties(${TARGET_LIB_NAME} PROPERTIES
Expand All @@ -1002,8 +1002,6 @@ function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLA
foreach(DEP_LIB_SRCS_INCLUDE ${DEP_LIB_SRCS_INCLUDES})
target_include_directories(${TARGET_NAME} PUBLIC ${DEP_LIB_SRCS_INCLUDE})
endforeach(DEP_LIB_SRCS_INCLUDE ${DEP_LIB_SRCS_INCLUDES})
# TODO([email protected]): rmeove LIB_INCLUDES in file scope andchields
list(APPEND LIB_INCLUDES "-I\"${LIB_PATH}\" -I\"${LIB_PATH}/utility\"")

target_link_libraries(${TARGET_LIB_NAME} ${BOARD_ID}_CORE ${LIB_TARGETS})
list(APPEND LIB_TARGETS ${TARGET_LIB_NAME})
Expand All @@ -1017,7 +1015,6 @@ function(setup_arduino_library VAR_NAME BOARD_ID LIB_PATH COMPILE_FLAGS LINK_FLA
list(REMOVE_DUPLICATES LIB_TARGETS)
endif()
set(${VAR_NAME} ${LIB_TARGETS} PARENT_SCOPE)
set(${VAR_NAME}_INCLUDES ${LIB_INCLUDES} PARENT_SCOPE)
endfunction()

#=============================================================================#
Expand All @@ -1037,18 +1034,15 @@ endfunction()
#=============================================================================#
function(setup_arduino_libraries VAR_NAME BOARD_ID SRCS ARDLIBS COMPILE_FLAGS LINK_FLAGS INCLUDE_PATHS)
set(LIB_TARGETS)
set(LIB_INCLUDES)

find_arduino_libraries(TARGET_LIBS "${SRCS}" ARDLIBS)
foreach(TARGET_LIB ${TARGET_LIBS})
# Create static library instead of returning sources
setup_arduino_library(LIB_DEPS ${BOARD_ID} ${TARGET_LIB} "${COMPILE_FLAGS}" "${LINK_FLAGS} ${INCLUDE_PATHS}")
list(APPEND LIB_TARGETS ${LIB_DEPS})
list(APPEND LIB_INCLUDES ${LIB_DEPS_INCLUDES})
endforeach()

set(${VAR_NAME} ${LIB_TARGETS} PARENT_SCOPE)
set(${VAR_NAME}_INCLUDES ${LIB_INCLUDES} PARENT_SCOPE)
endfunction()


Expand Down

0 comments on commit d76c9fb

Please sign in to comment.