Skip to content

Commit fad7f34

Browse files
authored
Merge pull request #13870 from rajkan01/feature-cmake-review-comment
CMake: Address review comment from PR#13566
2 parents 96f3de6 + 438994d commit fad7f34

File tree

11 files changed

+47
-74
lines changed

11 files changed

+47
-74
lines changed

CMakeLists.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,6 @@ if(${MBED_TOOLCHAIN_FILE_USED})
6262
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})
6363
endif()
6464

65-
66-
set(MBED_TARGET_LABELS
67-
${MBED_TARGET_LABELS} CACHE INTERNAL ""
68-
)
69-
7065
target_compile_definitions(mbed-core
7166
INTERFACE
7267
${MBED_TARGET_DEFINITIONS}
@@ -124,7 +119,12 @@ add_subdirectory(cmsis/device/rtos EXCLUDE_FROM_ALL)
124119
# Configures the application
125120
#
126121
function(mbed_configure_app_target target)
127-
mbed_set_language_standard(${target})
122+
# Set the language standard to use per target
123+
target_compile_features(${target}
124+
PUBLIC
125+
c_std_11
126+
cxx_std_14
127+
)
128128
endfunction()
129129

130130
#
Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
if("MCU_NRF52840" IN_LIST MBED_TARGET_LABELS)
5-
add_subdirectory(TARGET_MCU_NRF52840)
6-
elseif("NRF5x" IN_LIST MBED_TARGET_LABELS)
4+
if("NRF5x" IN_LIST MBED_TARGET_LABELS)
75
add_subdirectory(TARGET_NRF5x)
86
endif()

connectivity/drivers/ble/FEATURE_BLE/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_MCU_NRF52840/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
This file was deleted.

connectivity/drivers/ble/FEATURE_BLE/TARGET_NORDIC/TARGET_NORDIC_CORDIO/TARGET_NRF5x/CMakeLists.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,3 +19,9 @@ target_sources(mbed-ble-cordio
1919
stack/sources/pal_crypto.c
2020
stack/sources/pal_timer.c
2121
)
22+
23+
target_link_libraries(mbed-ble-cordio
24+
INTERFACE
25+
mbed-ble-cordio_ll
26+
mbed-mbedtls-cryptocell310
27+
)

connectivity/drivers/mbedtls/FEATURE_CRYPTOCELL310/CMakeLists.txt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ target_sources(mbed-mbedtls-cryptocell310
2929
source/trng.c
3030
)
3131

32+
target_compile_definitions(mbed-mbedtls-cryptocell310
33+
INTERFACE
34+
MBED_CONF_CRYPTOCELL310_PRESENT=1
35+
)
36+
3237
target_link_libraries(mbed-mbedtls-cryptocell310
3338
INTERFACE
3439
mbed-mbedtls
Lines changed: 17 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,16 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
function(_mbed_get_libcc_310_ext)
5-
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
6-
set(LIBCC_310_EXT TOOLCHAIN_GCC_ARM/libcc_310_ext.a)
7-
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
8-
set(LIBCC_310_EXT TOOLCHAIN_ARM/libcc_310_ext.ar)
9-
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
10-
set(LIBCC_310_EXT TOOLCHAIN_IAR/lib_cc310_ext.a)
11-
endif()
12-
target_link_libraries(mbed-mbedtls-cryptocell310
13-
INTERFACE
14-
./${LIBCC_310_EXT}
15-
)
16-
endfunction()
17-
18-
function(_mbed_get_libcc_310_trng)
19-
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
20-
set(LIBCC_310_TRNG TOOLCHAIN_GCC_ARM/libcc_310_trng.a)
21-
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
22-
set(LIBCC_310_TRNG TOOLCHAIN_ARM/libcc_310_trng.ar)
23-
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
24-
set(LIBCC_310_TRNG TOOLCHAIN_IAR/lib_cc310_trng.a)
25-
endif()
26-
target_link_libraries(mbed-mbedtls-cryptocell310
27-
INTERFACE
28-
./${LIBCC_310_TRNG}
29-
)
30-
endfunction()
31-
32-
_mbed_get_libcc_310_ext()
33-
_mbed_get_libcc_310_trng()
4+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
5+
set(LIBCC_310_EXT TOOLCHAIN_GCC_ARM/libcc_310_ext.a)
6+
set(LIBCC_310_TRNG TOOLCHAIN_GCC_ARM/libcc_310_trng.a)
7+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
8+
set(LIBCC_310_EXT TOOLCHAIN_ARM/libcc_310_ext.ar)
9+
set(LIBCC_310_TRNG TOOLCHAIN_ARM/libcc_310_trng.ar)
10+
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
11+
set(LIBCC_310_EXT TOOLCHAIN_IAR/lib_cc310_ext.a)
12+
set(LIBCC_310_TRNG TOOLCHAIN_IAR/lib_cc310_trng.a)
13+
endif()
3414

3515
target_include_directories(mbed-mbedtls-cryptocell310
3616
INTERFACE
@@ -40,4 +20,10 @@ target_include_directories(mbed-mbedtls-cryptocell310
4020
target_sources(mbed-mbedtls-cryptocell310
4121
INTERFACE
4222
crypto_device_platform.c
43-
)
23+
)
24+
25+
target_link_libraries(mbed-mbedtls-cryptocell310
26+
INTERFACE
27+
${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_EXT}
28+
${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_TRNG}
29+
)
Lines changed: 11 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,15 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
function(_mbed_get_libcc_310_core)
5-
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
6-
set(LIBCC_310_CORE TOOLCHAIN_GCC_ARM/libcc_310_core.a)
7-
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
8-
set(LIBCC_310_CORE TOOLCHAIN_ARM/libcc_310_core.ar)
9-
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
10-
set(LIBCC_310_CORE TOOLCHAIN_IAR/lib_cc310_ext.a)
11-
endif()
12-
target_link_libraries(mbed-mbedtls-cryptocell310
13-
INTERFACE
14-
./${LIBCC_310_CORE}
15-
)
16-
endfunction()
4+
if(${MBED_TOOLCHAIN} STREQUAL "GCC_ARM")
5+
set(LIBCC_310_CORE TOOLCHAIN_GCC_ARM/libcc_310_core.a)
6+
elseif(${MBED_TOOLCHAIN} STREQUAL "ARM")
7+
set(LIBCC_310_CORE TOOLCHAIN_ARM/libcc_310_core.ar)
8+
elseif(${MBED_TOOLCHAIN} STREQUAL "IAR")
9+
set(LIBCC_310_CORE TOOLCHAIN_IAR/lib_cc310_ext.a)
10+
endif()
1711

18-
_mbed_get_libcc_310_core()
12+
target_link_libraries(mbed-mbedtls-cryptocell310
13+
INTERFACE
14+
${CMAKE_CURRENT_SOURCE_DIR}/${LIBCC_310_CORE}
15+
)

connectivity/netsocket/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Copyright (c) 2020 ARM Limited. All rights reserved.
22
# SPDX-License-Identifier: Apache-2.0
33

4-
# TODO CMake: Perhaps move this/these file(s)
4+
# TODO CMake: Perhaps move this/these file(s) into connectivity/drivers/cellular
55
target_sources(mbed-cellular
66
INTERFACE
77
source/CellularNonIPSocket.cpp

tools/cmake/toolchain.cmake

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -46,23 +46,6 @@ set(CMAKE_CROSSCOMPILING TRUE)
4646
set(CMAKE_C_COMPILER_WORKS TRUE)
4747
set(CMAKE_CXX_COMPILER_WORKS TRUE)
4848

49-
# Set the language standard to use per target
50-
function(mbed_set_language_standard target)
51-
set_target_properties(${target}
52-
PROPERTIES
53-
C_STANDARD 11
54-
C_STANDARD_REQUIRED YES
55-
C_EXTENSIONS YES
56-
)
57-
58-
set_target_properties(${target}
59-
PROPERTIES
60-
CXX_STANDARD 14
61-
CXX_STANDARD_REQUIRED YES
62-
CXX_EXTENSIONS YES
63-
)
64-
endfunction()
65-
6649
# Clear toolchains options for all languages as Mbed OS uses
6750
# different initialisation options (such as for optimization and debug symbols)
6851
set(CMAKE_C_FLAGS_DEBUG "" CACHE STRING "" FORCE)

0 commit comments

Comments
 (0)