Skip to content
This repository was archived by the owner on Apr 17, 2023. It is now read-only.

Commit d8e840e

Browse files
committed
Fixed platform libs bug completely.
It appears that an existing platform lib target has been rebuilding on each subsequent cmake run even though it shouldn't. Now it's created and linked as a valid Arduino-CMake library once, then linked as an existing target.
1 parent 644b2f1 commit d8e840e

File tree

2 files changed

+8
-10
lines changed

2 files changed

+8
-10
lines changed

cmake/Platform/Targets/ArduinoCMakeLibraryTarget.cmake

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function(_link_arduino_cmake_library _target_name _library_name)
7373
message(FATAL_ERROR "Target doesn't exist - It must be created first!")
7474
endif ()
7575

76-
set(scope_options "PRIVATE" "PUBLIC" "INTERFACE" "PLATFORM_LIB")
76+
set(scope_options "PRIVATE" "PUBLIC" "INTERFACE")
7777
cmake_parse_arguments(link_library "${scope_options}" "BOARD_CORE_TARGET" "" ${ARGN})
7878

7979
# First, include core lib's directories in library as well
@@ -85,9 +85,7 @@ function(_link_arduino_cmake_library _target_name _library_name)
8585

8686
get_target_property(core_lib_includes ${core_target} INCLUDE_DIRECTORIES)
8787
target_include_directories(${_library_name} PUBLIC "${core_lib_includes}")
88-
if (NOT link_library_PLATFORM_LIB)
89-
target_link_libraries(${_library_name} PUBLIC ${core_target})
90-
endif ()
88+
target_link_libraries(${_library_name} PUBLIC ${core_target})
9189

9290
# Now, link library to executable
9391
if (link_library_PUBLIC)

cmake/Platform/Targets/PlatformLibraryTarget.cmake

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,12 @@ function(link_platform_library _target_name _library_name _board_id)
4848

4949
if (NOT TARGET ${_library_name})
5050
_add_platform_library(${_library_name} ${_board_id})
51+
get_core_lib_target_name(${_board_id} core_lib_target)
52+
_link_arduino_cmake_library(${_target_name} ${_library_name}
53+
PUBLIC
54+
BOARD_CORE_TARGET ${core_lib_target})
55+
else ()
56+
target_link_libraries(${_target_name} PUBLIC ${_library_name})
5157
endif ()
5258

53-
get_core_lib_target_name(${_board_id} core_lib_target)
54-
_link_arduino_cmake_library(${_target_name} ${_library_name}
55-
PUBLIC PLATFORM_LIB
56-
BOARD_CORE_TARGET ${core_lib_target})
57-
#target_link_libraries(${_target_name} PUBLIC ${_library_name})
58-
5959
endfunction()

0 commit comments

Comments
 (0)