mbed-os/storage/kvstore
Robert Walton a0befae2d4 CMake: Only build unit tests if Mbed OS is the current project
Typically when adding a unit test directory to a CMake project a check
will be used to ensure the subdirectory is added only if the following
are true:

* The BUILD_TESTING option is set to ON.
* The current CMake project is the top-level project.

The reason being, if a downstream project includes our project they
generally don't want to build our unit tests.

In mbed-os, we do correctly specify the above condition before adding
the central UNITTEST subdirectory, which fetches googletest and adds the
"stub" libraries the unit tests depend on. However, we only check if
CMAKE_CROSSCOMPILING is OFF (or undefined) before actually adding the
unit tests. This mismatched logic would lead to unexpected build
failures in various scenarios. One likely case could be: a downstream
project including mbed-os happens to set CMAKE_CROSSCOMPILING to
OFF/undefined for any reason (possibly to build its own unit tests).
mbed-os would go ahead and attempt to build its tests without fetching
googletest or adding the required stub targets.

To fix the issue replace the check for CMAKE_CROSSCOMPILING in the unit
tests with the same BUILD_TESTING idiom we use for adding the central
UNITTESTS subdirectory.
2021-06-10 23:34:14 +01:00
..
direct_access_devicekey KVStore: drop './' from CMake paths 2020-12-09 17:26:32 +00:00
filesystemstore CMake: Only build unit tests if Mbed OS is the current project 2021-06-10 23:34:14 +01:00
include/kvstore Create a kvstore_global_api for the global API and KVMap 2020-12-09 17:20:42 +00:00
kv_config Deprecate TDB_EXTERNAL_NO_RBP and FILESYSTEM_NO_RBP in kv_config 2021-05-11 17:19:10 +01:00
kvstore_global_api "kvstore_global_api" requires "kvstore" for backward compatibility 2020-12-09 17:26:32 +00:00
securestore CMake: streamline kvstore support 2020-12-17 13:09:38 +00:00
tdbstore CMake: Only build unit tests if Mbed OS is the current project 2021-06-10 23:34:14 +01:00
tests/TESTS/kvstore CMake: rename greentea test macro 2021-02-02 07:43:40 -08:00
CMakeLists.txt CMake: Add Blockdevice dependency to KVstore library 2020-12-21 13:57:52 +00:00
mbed_lib.json Create a kvstore_global_api for the global API and KVMap 2020-12-09 17:20:42 +00:00