programs: Link to tests common code

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
diff --git a/programs/x509/CMakeLists.txt b/programs/x509/CMakeLists.txt
index 02d783c..f7b5fe1 100644
--- a/programs/x509/CMakeLists.txt
+++ b/programs/x509/CMakeLists.txt
@@ -19,7 +19,7 @@
 )
 
 foreach(exe IN LISTS executables)
-    add_executable(${exe} ${exe}.c)
+    add_executable(${exe} ${exe}.c $<TARGET_OBJECTS:mbedtls_test>)
     target_link_libraries(${exe} ${libs})
 endforeach()