I am integrating a library that includes files based on C preprocessor macros. As an example:
#if !defined(MBEDTLS_CONFIG_FILE)
#include “mbedtls/config.h”
#else
#include MBEDTLS_CONFIG_FILE
#endif
In my CMAKE file I have added the required definition as follows:
target_compile_definitions(MBEDTLS
PUBLIC
MBEDTLS_CONFIG_FILE=“ua_mbedtls_config.h”)
On both Linux and Windows the compile definition is not applied when configuring the dependencies as touching the header file does not cause a build of the dependent source files. If I simply include the header file in the code as follows everything works as you would expect:
#include “ua_mbedtls_config.h”
How can I get the preprocessor macro to be applied when the header dependencies are generated? This pattern is used throughout the code base and I cannot change it.
Many thanks,
Liam.