Skip to content

Commit a2ef4b4

Browse files
committed
Create mbed-wifi target instantly instead of lazily
Reasons for this change: 1. One dummy 'mbed-wifi' target will add little to compile time. 2. The location where the 'mbed-wifi' target is created is now fixed to the top directory. CMake commands e.g. add_custom_command are required to invoke in the same directory as where the 'mbed-wifi' target is created, and can be invoked consistently in this fixed top directory.
1 parent e9b09e9 commit a2ef4b4

File tree

2 files changed

+13
-15
lines changed

2 files changed

+13
-15
lines changed
Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,25 @@
11
# Copyright (c) 2020-2021 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# The 'mbed-wifi' target is lazily created because there might not be any subdirectories needing it at all.
5-
macro(create_mbed_wifi_target)
6-
if(NOT TARGET mbed-wifi)
7-
add_library(mbed-wifi STATIC EXCLUDE_FROM_ALL)
4+
# The 'mbed-wifi' target is created instantly instead of lazily for below reasons:
5+
# 1. One dummy 'mbed-wifi' target will add little to compile time.
6+
# 2. The location where the 'mbed-wifi' target is created is now fixed to the
7+
# top directory. CMake commands e.g. add_custom_command are required to
8+
# invoke in the same directory as where the 'mbed-wifi' target is created,
9+
# and can be invoked consistently in this fixed top directory.
10+
add_library(mbed-wifi STATIC EXCLUDE_FROM_ALL)
11+
12+
target_link_libraries(mbed-wifi
13+
PUBLIC
14+
mbed-rtos-flags
15+
mbed-netsocket-api
16+
)
817

9-
target_link_libraries(mbed-wifi
10-
PUBLIC
11-
mbed-rtos-flags
12-
mbed-netsocket-api
13-
)
14-
endif()
15-
endmacro()
1618

1719

1820
# The WICED subdirectory is for wifi drivers developed using Infineon WICED framework.
1921
# https://community.infineon.com/t5/Knowledge-Base-Articles/WICED-Wi-Fi-FAQ/ta-p/247356
2022
if("WICED" IN_LIST MBED_TARGET_LABELS)
21-
create_mbed_wifi_target()
2223
add_subdirectory(TARGET_WICED EXCLUDE_FROM_ALL)
2324
endif()
2425

@@ -27,12 +28,10 @@ if("STM" IN_LIST MBED_TARGET_LABELS)
2728
endif()
2829

2930
if("WHD" IN_LIST MBED_TARGET_LABELS)
30-
create_mbed_wifi_target()
3131
add_subdirectory(COMPONENT_WHD EXCLUDE_FROM_ALL)
3232
endif()
3333

3434
if("COMPONENT_ESPRESSIF_ESP8266=1" IN_LIST MBED_TARGET_DEFINITIONS)
35-
create_mbed_wifi_target()
3635
add_subdirectory(COMPONENT_ESPRESSIF_ESP8266)
3736
endif()
3837

connectivity/drivers/wifi/TARGET_STM/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,5 @@
22
# SPDX-License-Identifier: Apache-2.0
33

44
if("EMW3080B" IN_LIST MBED_TARGET_LABELS)
5-
create_mbed_wifi_target()
65
add_subdirectory(COMPONENT_EMW3080B EXCLUDE_FROM_ALL)
76
endif()

0 commit comments

Comments
 (0)