Merge pull request #14765 from rwalton-arm/fix_unittest_check

Fix unittest check
pull/14772/head
Martin Kojtal 2021-06-14 10:17:17 +02:00 committed by GitHub
commit 50e23b75f8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 25 additions and 24 deletions

View File

@ -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()
@ -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
@ -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
# to a global property here. The MBED_TARGET being built queries this global property when it sets
# the linker script.
#
@ -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.
@ -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()

View File

@ -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)

View File

@ -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
@ -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
@ -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

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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()

View File

@ -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

View File

@ -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()

View File

@ -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
)

View File

@ -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()

View File

@ -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()

View File

@ -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()