Change the cpp test to be optional
Remove unnecessary defines from the test.
Test by defining TEST_CPP using makefiles or cmake.
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 2a10d7c..6133d07 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,9 @@
cmake_minimum_required(VERSION 2.6)
-project("mbed TLS" C CXX)
+if(TEST_CPP)
+ project("mbed TLS" C CXX)
+else()
+ project("mbed TLS" C)
+endif()
option(USE_PKCS11_HELPER_LIBRARY "Build mbed TLS with the pkcs11-helper library." OFF)
option(ENABLE_ZLIB_SUPPORT "Build mbed TLS with zlib library." OFF)
diff --git a/programs/Makefile b/programs/Makefile
index c5dd9f9..844d680 100644
--- a/programs/Makefile
+++ b/programs/Makefile
@@ -70,7 +70,6 @@
test/ssl_cert_test$(EXEXT) test/benchmark$(EXEXT) \
test/selftest$(EXEXT) test/udp_proxy$(EXEXT) \
test/zeroize$(EXEXT) \
- test/header_test$(EXEXT) \
util/pem2der$(EXEXT) util/strerror$(EXEXT) \
x509/cert_app$(EXEXT) x509/crl_app$(EXEXT) \
x509/cert_req$(EXEXT) x509/cert_write$(EXEXT) \
@@ -80,6 +79,10 @@
APPS += ssl/ssl_pthread_server$(EXEXT)
endif
+ifdef TEST_CPP
+APPS += test/header_test$(EXEXT)
+endif
+
.SILENT:
.PHONY: all clean list
diff --git a/programs/test/CMakeLists.txt b/programs/test/CMakeLists.txt
index 32c1415..6791ffd 100644
--- a/programs/test/CMakeLists.txt
+++ b/programs/test/CMakeLists.txt
@@ -16,9 +16,11 @@
add_executable(benchmark benchmark.c)
target_link_libraries(benchmark ${libs})
-add_executable(header_test header_test.cpp)
-target_link_libraries(header_test ${libs})
-
+if(TEST_CPP)
+ add_executable(header_test header_test.cpp)
+ target_link_libraries(header_test ${libs})
+endif()
+
add_executable(ssl_cert_test ssl_cert_test.c)
target_link_libraries(ssl_cert_test ${libs})
diff --git a/programs/test/header_test.cpp b/programs/test/header_test.cpp
index d1ddd4b..69d7c4a 100644
--- a/programs/test/header_test.cpp
+++ b/programs/test/header_test.cpp
@@ -102,14 +102,6 @@
#if defined(MBEDTLS_PLATFORM_C)
#include "mbedtls/platform.h"
-#else
-#include <stdio.h>
-#include <stdlib.h>
-#define mbedtls_printf printf
-#define mbedtls_snprintf snprintf
-#define mbedtls_exit exit
-#define MBEDTLS_EXIT_SUCCESS EXIT_SUCCESS
-#define MBEDTLS_EXIT_FAILURE EXIT_FAILURE
#endif
#if defined(MBEDTLS_MEMORY_BUFFER_ALLOC_C)