55function (_is_board_core_valid _board_core _board_id)
66
77 list (FIND ARDUINO_CMAKE_PLATFORM_CORES "${board_core} " index)
8+
89 if (${index} LESS 0)
910 message (FATAL_ERROR "Unknown board core \" ${board_core} \" for the ${_board_id} board" )
1011 endif ()
@@ -18,6 +19,7 @@ endfunction()
1819function (_is_board_variant_valid _board_variant _board_id)
1920
2021 list (FIND ARDUINO_CMAKE_PLATFORM_VARIANTS "${board_variant} " index)
22+
2123 if (${index} LESS 0)
2224 message (FATAL_ERROR "Unknown board variant \" ${board_variant} \" for the ${_board_id} board" )
2325 endif ()
@@ -64,23 +66,23 @@ endfunction()
6466function (_set_core_lib_flags _core_target_name)
6567
6668 set_target_compile_flags(${_core_target_name} PUBLIC )
67-
68- set_linker_flags(${_core_target_name} )
69+ set_target_linker_flags(${_core_target_name} )
6970
7071endfunction ()
7172
7273#=============================================================================#
7374# Adds/Creates a static library target for Arduino's core library (Core-Lib),
74- # required by every standard Arduino Application/Executable.
75- # The library is then linked against the given executable target
76- # (Which also means is has to be created first).
75+ # required by every arduino target.
7776# _target_name - Name of the Application/Executable target created earlier.
7877# _board_id - Board to create the core library for.
7978# Note that each board has a unique version of the library.
8079#=============================================================================#
8180function (add_arduino_core_lib _target_name)
8281
83- get_core_lib_target_name(${board_id} core_lib_target)
82+ # First, retrieve the board_id associated with the target from the matching property
83+ get_target_property (board_id ${_target_name} BOARD_ID)
84+
85+ generate_core_lib_target_name(${board_id} core_lib_target)
8486
8587 if (TARGET ${core_lib_target} ) # Core-lib target already created for the given board
8688 if (TARGET ${_target_name} ) # Executable/Firmware target also exists
@@ -89,16 +91,13 @@ function(add_arduino_core_lib _target_name)
8991
9092 else () # Core-Lib target needs to be created
9193
92- # First, retrieve the board_id associated with the target from the matching property
93- get_target_property (board_id ${_target_name} BOARD_ID)
94-
9594 _get_board_core(${board_id} board_core) # Get board's core
9695 _get_board_variant(${board_id} board_variant) # Get board's variant
9796
9897 # Find sources in core directory and add the library target
9998 find_source_files("${ARDUINO_CMAKE_CORE_${board_core} _PATH}" core_sources)
10099
101- if (${ CMAKE_HOST_UNIX} )
100+ if (CMAKE_HOST_UNIX )
102101 if (CMAKE_HOST_UBUNTU OR CMAKE_HOST_DEBIAN)
103102 list (FILTER core_sources EXCLUDE REGEX "[Mm]ain\\ .c.*" )
104103 endif ()
0 commit comments