Restrict the definition of memcheck/lcov targets

Restrict the definition of memcheck/lcov targets
to the case where Mbed TLS/TF-PSA-Crypto is the
main project. To avoid conflict between the
targets when the integration of the TF-PSA-Crypto
build system into the Mbed TLS one is completed.

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 86b0ffa..aef6747 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -473,8 +473,7 @@
     add_subdirectory(tests)
 
     # additional convenience targets for Unix only
-    if(UNIX)
-
+    if(UNIX AND (NOT MBEDTLS_AS_SUBPROJECT))
         # For coverage testing:
         # 1. Build with:
         #         cmake -D CMAKE_BUILD_TYPE=Coverage /path/to/source && make
@@ -493,7 +492,7 @@
             COMMAND rm -f memcheck.log
             COMMAND mv DartConfiguration.tcl.bak DartConfiguration.tcl
         )
-    endif(UNIX)
+    endif()
 
     # Make scripts needed for testing available in an out-of-source build.
     if (NOT ${CMAKE_CURRENT_BINARY_DIR} STREQUAL ${CMAKE_CURRENT_SOURCE_DIR})