diff --git a/.github/workflows/basic_checks.yml b/.github/workflows/basic_checks.yml index 608dffa..f476d18 100644 --- a/.github/workflows/basic_checks.yml +++ b/.github/workflows/basic_checks.yml @@ -229,6 +229,6 @@ name: cmake unittest run: | set -x - ctest --build-and-test . build --build-generator Ninja --build-options -DBUILD_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON --test-command ctest + ctest --build-and-test . build --build-generator Ninja --build-options -DMBED_ENABLE_TESTING=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERAGE=ON --test-command ctest gcovr --gcov-executable gcov -r . ./build -s -e ".*\.h" --exclude-directories=${GITHUB_WORKSPACE}/build/UNITTESTS --exclude-directories=${GITHUB_WORKSPACE}/build/_deps ccache -s diff --git a/.github/workflows/greentea_cmake.yml b/.github/workflows/greentea_cmake.yml index fc075dc..258366b 100644 --- a/.github/workflows/greentea_cmake.yml +++ b/.github/workflows/greentea_cmake.yml @@ -19,12 +19,12 @@ run: | rm -rf __build mbedtools configure -t GCC_ARM -m NUCLEO_G031K8 --mbed-os-path . --output-dir __build --app-config TESTS/configs/baremetal.json - cmake -S . -B __build -GNinja -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DBUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_TEST_BAREMETAL=ON + cmake -S . -B __build -GNinja -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DMBED_BUILD_GREENTEA_TESTS=ON -DMBED_GREENTEA_TEST_BAREMETAL=ON cmake --build __build - name: Build ARM_MUSCA_S1 with full profile run: | rm -rf __build mbedtools configure -t GCC_ARM -m ARM_MUSCA_S1 --mbed-os-path . --output-dir __build - cmake -S . -B __build -GNinja -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DBUILD_GREENTEA_TESTS=ON + cmake -S . -B __build -GNinja -DCMAKE_CTEST_ARGUMENTS="--output-on-failure;-V" -DMBED_BUILD_GREENTEA_TESTS=ON cmake --build __build diff --git a/.github/workflows/host_tests.yml b/.github/workflows/host_tests.yml index e08328d..57fc1d9 100644 --- a/.github/workflows/host_tests.yml +++ b/.github/workflows/host_tests.yml @@ -15,6 +15,6 @@ - name: Compile and test for host run: | mkdir __build && cd __build - cmake .. -GNinja -DBUILD_GREENTEA_TESTS=FALSE -DBUILD_TESTING=TRUE + cmake .. -GNinja -DMBED_BUILD_GREENTEA_TESTS=FALSE -DMBED_ENABLE_TESTING=TRUE ninja ctest . --output-on-failure diff --git a/.lgtm.yml b/.lgtm.yml index b3a7b64..30a168e 100644 --- a/.lgtm.yml +++ b/.lgtm.yml @@ -20,7 +20,7 @@ - cmake --version configure: command: - - cmake -S . -B __build -GNinja -DBUILD_TESTING=ON -DCOVERAGE=OFF -DCMAKE_BUILD_TYPE=Debug + - cmake -S . -B __build -GNinja -DMBED_ENABLE_TESTING=ON -DCOVERAGE=OFF -DCMAKE_BUILD_TYPE=Debug index: build_command: - cmake --build __build diff --git a/CMakeLists.txt b/CMakeLists.txt index 2741065..31c4644 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,32 +8,32 @@ # Setup build type (target type, tests/unit tests/real build) ---------------------------------------------------------------------------------- # This block sets up the following variables for all subdirs to use: -# - MBED_OS_IS_STANDALONE: True if Mbed OS is the top-level project. False if Mbed is being built as part of an application. +# - MBED_IS_STANDALONE: True if Mbed OS is the top-level project. False if Mbed is being built as part of an application. # - MBED_IS_NATIVE_BUILD: True if we are building for the host machine. False if we are building for a microcontroller -# - MBED_OS_ENABLE_TESTS: True if we are building *any* internal Mbed OS tests at all. Enabled by -DBUILD_TESTING=TRUE (which is enabled by default when standalone). -# - BUILD_GREENTEA_TESTS: True to build greentea on-target tests. False to build host UNITTESTS. Defaults to false when standalone. +# - MBED_ENABLE_OS_INTERNAL_TESTS: True if we are building *any* internal Mbed OS tests at all. Enabled by -DMBED_ENABLE_TESTING=TRUE (which is enabled by default when standalone). +# - MBED_BUILD_GREENTEA_TESTS: True to build greentea on-target tests. False to build host UNITTESTS. Defaults to false when standalone. if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) # We are the top level project, so tests or unittests are being built. - set(MBED_OS_IS_STANDALONE TRUE) + set(MBED_IS_STANDALONE TRUE) else() # Not the top level project - set(MBED_OS_IS_STANDALONE FALSE) + set(MBED_IS_STANDALONE FALSE) endif() # Set up options for testing -option(BUILD_TESTING "Whether to enable CTest tests in this project" ${MBED_OS_IS_STANDALONE}) # This option is also created by include(CTest) but we need it here earlier on. -if(MBED_OS_IS_STANDALONE AND BUILD_TESTING) - set(MBED_OS_ENABLE_TESTS TRUE) - option(BUILD_GREENTEA_TESTS "Build greentea tests instead of unit tests" FALSE) +option(MBED_ENABLE_TESTING "Whether to enable CTest tests in this project" ${MBED_IS_STANDALONE}) # This option is also created by include(CTest) but we need it here earlier on. +if(MBED_IS_STANDALONE AND MBED_ENABLE_TESTING) + set(MBED_ENABLE_OS_INTERNAL_TESTS TRUE) + option(MBED_BUILD_GREENTEA_TESTS "Build greentea tests instead of unit tests" FALSE) endif() # Figure out if this is a native build -if(MBED_OS_IS_STANDALONE) +if(MBED_IS_STANDALONE) - # Standalone build, use BUILD_GREENTEA_TESTS to determine if we are building for native or not (user can select) - if(BUILD_GREENTEA_TESTS) + # Standalone build, use MBED_BUILD_GREENTEA_TESTS to determine if we are building for native or not (user can select) + if(MBED_BUILD_GREENTEA_TESTS) set(MBED_IS_NATIVE_BUILD FALSE) else() set(MBED_IS_NATIVE_BUILD TRUE) @@ -51,7 +51,7 @@ endif() -if(MBED_OS_IS_STANDALONE AND NOT MBED_IS_NATIVE_BUILD) +if(MBED_IS_STANDALONE AND NOT MBED_IS_NATIVE_BUILD) # For standalone builds, default to looking for mbed-config.cmake in the binary dir set(MBED_CONFIG_PATH ${CMAKE_CURRENT_BINARY_DIR} CACHE STRING "") @@ -70,8 +70,8 @@ endif() # Print build type -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) message(STATUS "Mbed: Compiling Greentea on-target tests for ${MBED_TARGET}") else() message(STATUS "Mbed: Compiling host UNITTESTS for native execution") @@ -101,17 +101,17 @@ add_subdirectory(extern) -if(MBED_OS_IS_STANDALONE) - include(CTest) - - if((NOT BUILD_GREENTEA_TESTS) AND BUILD_TESTING) +if(MBED_IS_STANDALONE) + if((NOT MBED_BUILD_GREENTEA_TESTS) AND MBED_ENABLE_TESTING) # Building unit tests only. add_definitions(-DUNITTEST) add_subdirectory(UNITTESTS) endif() endif() -if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_TESTING) + include(CTest) + include(mbed_greentea) endif() @@ -172,8 +172,8 @@ ) # Add MBED_TEST_MODE for backward compatibility with Greentea tests written for use with Mbed CLI 1 - if(MBED_OS_ENABLE_TESTS) - if(NOT BUILD_GREENTEA_TESTS) + if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(NOT MBED_BUILD_GREENTEA_TESTS) target_compile_definitions(${PROJECT_NAME} INTERFACE MBED_TEST_MODE diff --git a/UNITTESTS/unit_test/test.py b/UNITTESTS/unit_test/test.py index dd0a716..8ff4cc3 100644 --- a/UNITTESTS/unit_test/test.py +++ b/UNITTESTS/unit_test/test.py @@ -86,7 +86,7 @@ args = [cmake, "-G", generator, - "-DBUILD_TESTING=ON" + "-DMBED_ENABLE_TESTING=ON" "-DCMAKE_MAKE_PROGRAM=%s" % self.make_program, "-DCMAKE_CXX_COMPILER=%s" % get_cxx_tool(), "-DCMAKE_C_COMPILER=%s" % get_c_tool()] diff --git a/cmsis/CMakeLists.txt b/cmsis/CMakeLists.txt index 1dbef1b..035f666 100644 --- a/cmsis/CMakeLists.txt +++ b/cmsis/CMakeLists.txt @@ -4,6 +4,6 @@ add_subdirectory(CMSIS_5) add_subdirectory(device) -if(MBED_OS_ENABLE_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) add_subdirectory(tests/UNITTESTS/doubles) endif() diff --git a/connectivity/FEATURE_BLE/CMakeLists.txt b/connectivity/FEATURE_BLE/CMakeLists.txt index 8b746f9..7101df5 100644 --- a/connectivity/FEATURE_BLE/CMakeLists.txt +++ b/connectivity/FEATURE_BLE/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(NOT BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(NOT MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/UNITTESTS) endif() endif() diff --git a/connectivity/FEATURE_BLE/source/cordio/CMakeLists.txt b/connectivity/FEATURE_BLE/source/cordio/CMakeLists.txt index 17cb363..d4997de 100644 --- a/connectivity/FEATURE_BLE/source/cordio/CMakeLists.txt +++ b/connectivity/FEATURE_BLE/source/cordio/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(TESTS) endif() endif() diff --git a/connectivity/cellular/CMakeLists.txt b/connectivity/cellular/CMakeLists.txt index 037efc9..05add3e 100644 --- a/connectivity/cellular/CMakeLists.txt +++ b/connectivity/cellular/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/connectivity/libraries/CMakeLists.txt b/connectivity/libraries/CMakeLists.txt index d47bbda..3e30726 100644 --- a/connectivity/libraries/CMakeLists.txt +++ b/connectivity/libraries/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(NOT BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(NOT MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/UNITTESTS) endif() endif() diff --git a/connectivity/lorawan/CMakeLists.txt b/connectivity/lorawan/CMakeLists.txt index 901e1e2..b463316 100644 --- a/connectivity/lorawan/CMakeLists.txt +++ b/connectivity/lorawan/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/connectivity/mbedtls/CMakeLists.txt b/connectivity/mbedtls/CMakeLists.txt index ea13ae8..1d492be 100644 --- a/connectivity/mbedtls/CMakeLists.txt +++ b/connectivity/mbedtls/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(NOT BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(NOT MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/UNITTESTS) endif() endif() diff --git a/connectivity/netsocket/CMakeLists.txt b/connectivity/netsocket/CMakeLists.txt index cd3b680..025da92 100644 --- a/connectivity/netsocket/CMakeLists.txt +++ b/connectivity/netsocket/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) diff --git a/connectivity/nfc/CMakeLists.txt b/connectivity/nfc/CMakeLists.txt index aada036..a404051 100644 --- a/connectivity/nfc/CMakeLists.txt +++ b/connectivity/nfc/CMakeLists.txt @@ -5,8 +5,8 @@ add_subdirectory(libraries) -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) endif() endif() diff --git a/drivers/CMakeLists.txt b/drivers/CMakeLists.txt index 72ca713..dc5c85e 100644 --- a/drivers/CMakeLists.txt +++ b/drivers/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) diff --git a/events/CMakeLists.txt b/events/CMakeLists.txt index 2321150..4b81019 100644 --- a/events/CMakeLists.txt +++ b/events/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/hal/CMakeLists.txt b/hal/CMakeLists.txt index f530e8b..60308d9 100644 --- a/hal/CMakeLists.txt +++ b/hal/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020-2021 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) diff --git a/platform/CMakeLists.txt b/platform/CMakeLists.txt index b9a0bd5..c57fa0f 100644 --- a/platform/CMakeLists.txt +++ b/platform/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) diff --git a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt index 23fa1bb..9f47f51 100644 --- a/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt +++ b/platform/FEATURE_EXPERIMENTAL_API/FEATURE_PSA/TARGET_MBED_PSA_SRV/CMakeLists.txt @@ -73,8 +73,8 @@ add_subdirectory(test_abstraction_layers) -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(TESTS) endif() endif() diff --git a/rtos/CMakeLists.txt b/rtos/CMakeLists.txt index a126a93..e7c6aeb 100644 --- a/rtos/CMakeLists.txt +++ b/rtos/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) add_subdirectory(tests/TESTS) else() add_subdirectory(tests/UNITTESTS) diff --git a/storage/blockdevice/CMakeLists.txt b/storage/blockdevice/CMakeLists.txt index fd1c333..87c7645 100644 --- a/storage/blockdevice/CMakeLists.txt +++ b/storage/blockdevice/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(COMPONENT_QSPIF) diff --git a/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt b/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt index b4327da..4d22cc6 100644 --- a/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt +++ b/storage/blockdevice/COMPONENT_QSPIF/CMakeLists.txt @@ -16,8 +16,8 @@ target_link_libraries(mbed-storage-qspif PUBLIC mbed-storage-blockdevice) -if(MBED_OS_ENABLE_TESTS) - if (NOT BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if (NOT MBED_BUILD_GREENTEA_TESTS) add_subdirectory(UNITTESTS) endif() endif() diff --git a/storage/filesystem/CMakeLists.txt b/storage/filesystem/CMakeLists.txt index 9f9ea49..c3db308 100644 --- a/storage/filesystem/CMakeLists.txt +++ b/storage/filesystem/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/storage/kvstore/CMakeLists.txt b/storage/kvstore/CMakeLists.txt index 790ea5e..3e74e63 100644 --- a/storage/kvstore/CMakeLists.txt +++ b/storage/kvstore/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/storage/kvstore/filesystemstore/CMakeLists.txt b/storage/kvstore/filesystemstore/CMakeLists.txt index 633a446..f580c82 100644 --- a/storage/kvstore/filesystemstore/CMakeLists.txt +++ b/storage/kvstore/filesystemstore/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/storage/kvstore/tdbstore/CMakeLists.txt b/storage/kvstore/tdbstore/CMakeLists.txt index 048c909..7e468d0 100644 --- a/storage/kvstore/tdbstore/CMakeLists.txt +++ b/storage/kvstore/tdbstore/CMakeLists.txt @@ -1,8 +1,8 @@ # Copyright (c) 2020 ARM Limited. All rights reserved. # SPDX-License-Identifier: Apache-2.0 -if(MBED_OS_ENABLE_TESTS) - if(BUILD_GREENTEA_TESTS) +if(MBED_ENABLE_OS_INTERNAL_TESTS) + if(MBED_BUILD_GREENTEA_TESTS) # add greentea test else() add_subdirectory(tests/UNITTESTS) diff --git a/tools/cmake/tests/mbed_test_mode/main.cpp b/tools/cmake/tests/mbed_test_mode/main.cpp index 8669da7..dc16f65 100644 --- a/tools/cmake/tests/mbed_test_mode/main.cpp +++ b/tools/cmake/tests/mbed_test_mode/main.cpp @@ -4,8 +4,8 @@ * SPDX-License-Identifier: Apache-2.0 */ -#if BUILD_TESTING && !defined(MBED_TEST_MODE) -#error "MBED_TEST_MODE not defined with BUILD_TESTING on" +#if MBED_ENABLE_TESTING && !defined(MBED_TEST_MODE) +#error "MBED_TEST_MODE not defined with MBED_ENABLE_TESTING on" #else int main(){ return 0; diff --git a/tools/cmake/upload_methods/FindSTLINKTools.cmake b/tools/cmake/upload_methods/FindSTLINKTools.cmake index 91b23d9..0ee9eea 100644 --- a/tools/cmake/upload_methods/FindSTLINKTools.cmake +++ b/tools/cmake/upload_methods/FindSTLINKTools.cmake @@ -84,10 +84,9 @@ # Create COMMAND variables if(EXISTS "${STM32CubeProg_PATH}") - set(STM32CubeProg_COMMAND ${STM32CubeProg_PATH}) + set(STM32CubeProg_COMMAND ${STM32CubeProg_PATH} CACHE INTERNAL "" FORCE) endif() - # on Linux and Mac the GDB server needs help to find libSTLinkUSBDriver dll which is in a subfolder if(EXISTS "${STLINK_gdbserver_PATH}") @@ -97,13 +96,13 @@ if("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Linux") # Linux: set LD_LIBRARY_PATH - set(STLINK_gdbserver_COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${STLINK_NATIVE_DIR}" ${STLINK_gdbserver_PATH}) + set(STLINK_gdbserver_COMMAND ${CMAKE_COMMAND} -E env "LD_LIBRARY_PATH=${STLINK_NATIVE_DIR}" ${STLINK_gdbserver_PATH} CACHE INTERNAL "" FORCE) elseif("${CMAKE_HOST_SYSTEM_NAME}" STREQUAL "Darwin") # OS X: set DYLD_FALLBACK_LIBRARY_PATH - set(STLINK_gdbserver_COMMAND ${CMAKE_COMMAND} -E env "DYLD_FALLBACK_LIBRARY_PATH=${STLINK_NATIVE_DIR}" ${STLINK_gdbserver_PATH}) + set(STLINK_gdbserver_COMMAND ${CMAKE_COMMAND} -E env "DYLD_FALLBACK_LIBRARY_PATH=${STLINK_NATIVE_DIR}" ${STLINK_gdbserver_PATH} CACHE INTERNAL "" FORCE) else() # Windows -- doesn't need help - set(STLINK_gdbserver_COMMAND ${STLINK_gdbserver_PATH}) + set(STLINK_gdbserver_COMMAND ${STLINK_gdbserver_PATH} CACHE INTERNAL "" FORCE) endif() endif()