Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix unittest check #14765

Merged
merged 5 commits into from
Jun 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ endif()
project(mbed-os)

# Add all paths to the list files within Mbed OS
list(APPEND CMAKE_MODULE_PATH
list(APPEND CMAKE_MODULE_PATH
"${mbed-os_SOURCE_DIR}/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_TFM/TARGET_TFM_LATEST/scripts;${mbed-os_SOURCE_DIR}/targets/TARGET_Cypress/scripts;${mbed-os_SOURCE_DIR}/targets/TARGET_NXP/scripts"
)

option(BUILD_TESTING "Run unit tests only." OFF)

if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
include(CTest)
include(CTest)
add_subdirectory(UNITTESTS)
endif()

Expand Down Expand Up @@ -68,19 +68,19 @@ if(${CMAKE_CROSSCOMPILING})
"Invalid printf library type '${MBED_PRINTF_LIB}'. Possible values:\n ${MBED_PRINTF_LIB_TYPES}"
)
endif()

mbed_set_cpu_core_definitions(mbed-core)
if(${MBED_TOOLCHAIN_FILE_USED})
mbed_set_profile_options(mbed-core ${MBED_TOOLCHAIN})
mbed_set_c_lib(mbed-core ${MBED_C_LIB})
mbed_set_printf_lib(mbed-core ${MBED_PRINTF_LIB})

target_compile_features(mbed-core
INTERFACE
c_std_11
cxx_std_14
)

endif()

target_compile_definitions(mbed-core
Expand All @@ -98,7 +98,7 @@ if(${CMAKE_CROSSCOMPILING})
endif()

# We need to generate a "response file" to pass to the C preprocessor when we preprocess the linker
# script, because of path le ngth limitations on Windows. We set the response file and bind the path
# script, because of path length limitations on Windows. We set the response file and bind the path
Patater marked this conversation as resolved.
Show resolved Hide resolved
# to a global property here. The MBED_TARGET being built queries this global property when it sets
# the linker script.
#
Expand All @@ -110,7 +110,7 @@ if(${CMAKE_CROSSCOMPILING})
# using response files or global properties.
mbed_generate_options_for_linker(mbed-core RESPONSE_FILE_PATH)
set_property(GLOBAL PROPERTY COMPILE_DEFS_RESPONSE_FILE ${RESPONSE_FILE_PATH})

# Add compile definitions for backward compatibility with the toolchain
# supported. New source files should instead check for __GNUC__ and __clang__
# for the GCC_ARM and ARM toolchains respectively.
Expand Down Expand Up @@ -164,7 +164,7 @@ if(${CMAKE_CROSSCOMPILING})
string(TOLOWER ${MBED_TARGET} MBED_TARGET_CONVERTED)
string(REPLACE "_" "-" MBED_TARGET_CONVERTED ${MBED_TARGET_CONVERTED})
string(PREPEND MBED_TARGET_CONVERTED "mbed-")

target_link_libraries(mbed-core INTERFACE ${MBED_TARGET_CONVERTED})
endif()

Expand Down
2 changes: 1 addition & 1 deletion UNITTESTS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ include(FetchContent)
# Download and unpack googletest
FetchContent_Declare(googletest
GIT_REPOSITORY https://github.com/google/googletest.git
GIT_TAG release-1.10.0
GIT_TAG master
)
FetchContent_MakeAvailable(googletest)

Expand Down
8 changes: 4 additions & 4 deletions UNITTESTS/stubs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ target_include_directories(mbed-headers-base
)

target_include_directories(mbed-headers-storage
INTERFACE
INTERFACE
${mbed-os_SOURCE_DIR}/storage/filesystem/fat/include
${mbed-os_SOURCE_DIR}/storage/filesystem/fat/ChaN
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs/include
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefsv2/littlefs
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefsv2/littlefs/bd
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefsv2/littlefs/bd
${mbed-os_SOURCE_DIR}/storage/filesystem/littlefs/littlefs
${mbed-os_SOURCE_DIR}/storage/blockdevice/include
${mbed-os_SOURCE_DIR}/storage/filesystem/include
Expand Down Expand Up @@ -91,7 +91,7 @@ target_include_directories(mbed-headers-drivers
INTERFACE
${mbed-os_SOURCE_DIR}/drivers
${mbed-os_SOURCE_DIR}/drivers/include
${mbed-os_SOURCE_DIR}/drivers/include/drivers
${mbed-os_SOURCE_DIR}/drivers/include/drivers
)

target_include_directories(mbed-headers-events
Expand All @@ -100,7 +100,7 @@ target_include_directories(mbed-headers-events
${mbed-os_SOURCE_DIR}/events/tests/UNITTESTS/target_h/equeue
${mbed-os_SOURCE_DIR}/events/include
${mbed-os_SOURCE_DIR}/events/include/events
${mbed-os_SOURCE_DIR}/events/include/events/internal
${mbed-os_SOURCE_DIR}/events/include/events/internal
)

target_include_directories(mbed-headers-hal
Expand Down
2 changes: 1 addition & 1 deletion connectivity/cellular/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion connectivity/lorawan/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion connectivity/netsocket/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion drivers/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
3 changes: 2 additions & 1 deletion events/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
else()

add_library(mbed-events INTERFACE)

target_include_directories(mbed-events
Expand Down
2 changes: 1 addition & 1 deletion platform/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
4 changes: 2 additions & 2 deletions platform/tests/UNITTESTS/ATCmdParser/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ target_sources(${TEST_NAME}
target_link_libraries(${TEST_NAME}
PRIVATE
mbed-headers
mbed-stubs-headers
mbed-stubs-platform
mbed-stubs-headers
mbed-stubs-platform
gmock_main
)

Expand Down
2 changes: 1 addition & 1 deletion storage/blockdevice/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion storage/kvstore/filesystemstore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down
2 changes: 1 addition & 1 deletion storage/kvstore/tdbstore/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright (c) 2020 ARM Limited. All rights reserved.
# SPDX-License-Identifier: Apache-2.0

if(NOT ${CMAKE_CROSSCOMPILING})
if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING)
add_subdirectory(tests/UNITTESTS)
endif()

Expand Down