PolarSSL is now part of ARM Official announcement and rebranded as mbed TLS.

how to build with custom (user) config.h addition


Jul 8, 2016 17:05
Michael Richardson

The bottom of include/mbedtls/config.h has some macros to include custom config.h at the end:

#if defined(TARGET_LIKE_MBED)
#include "mbedtls/target_config.h"
#endif
...
#if defined(YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE)
#include YOTTA_CFG_MBEDTLS_USER_CONFIG_FILE
#elif defined(MBEDTLS_USER_CONFIG_FILE)
#include MBEDTLS_USER_CONFIG_FILE
#endif

While I realize that I can set these variables on the command line as indicated by configs/README.md, I wonder if this is the best way to do this inside the CMakefile?

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DMBEDTLS_USER_CONFIG_FILE=\\\"mbedtls/mcrhack.h\\\"")
 
Mar 23, 2017 11:35
Ron Eldor

Hi Michael,
configs/README.md describes a different method of setting your user defined configuration file, using cmake.
It mentions:

find . -iname '*cmake*' -not -name CMakeLists.txt -exec rm -rf {} + CFLAGS="-I$PWD/configs -DMBEDTLS_CONFIG_FILE='<foo.h>'" cmake .
make

This will generate your make files, using cmake, with your user defined configuration file.
I hope this helps
Regards,
mbed TLS Team member
Ron