diff --git a/CMakeLists.txt b/CMakeLists.txt index af7400c9f..f7e2ed08b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -238,6 +238,20 @@ list(APPEND libs ${thirdparty_lib}) add_subdirectory(library) +# +# The C files in tests/src directory contain test code shared among test suites +# and programs. This shared test code is compiled and linked to test suites and +# programs objects as a set of compiled objects. The compiled objects are NOT +# built into a library that the test suite and program objects would link +# against as they link against the mbedcrypto, mbedx509 and mbedtls libraries. +# The reason is that such library is expected to have mutual dependencies with +# the aforementioned libraries and that there is as of today no portable way of +# handling such dependencies (only toolchain specific solutions). +# +# Thus the below definition of the `mbedtls_test` CMake library of objects +# target. This library of objects is used by tests and programs CMake files +# to define the test executables. +# if(ENABLE_TESTING OR ENABLE_PROGRAMS) file(GLOB MBEDTLS_TEST_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/src/*.c) add_library(mbedtls_test OBJECT ${MBEDTLS_TEST_FILES})