Remove dependency on unsupported MbedTLS build interface
To build libmbedcrypto (part of MbedTLS) for different
deployments, it is necessary to provide a suitable TS project
defined configuration header file and include paths for PSA
storage. It turns out that we have been using an unsupported
CMake based interface to pass in the configuration path and
include paths (using 'thirdparty_inc' and 'thirdparty_defs'
cmake variables). These variables disappear in MbedTLS v3.0.0
so an alternative method is needed before upgrading.
MbedTLS doesn't currently provide its own cmake interface for
providing these parameters. This commit adds a general purpose
configuration interface that exploits the cmake toolchain file
functionality where the toolchain file is actioned early on
when a new cmake context is created. A common cmake file
called config_iface.cmake gets run when an environment's
toochain file is run. The caller may optionally define
the variables EXTERNAL_DEFINITIONS and EXTERNAL_INCLUDE_PATHS
to inject configuration parameters into the child cmake build.
This facility is used by the external component cmake file
for MbedTLS.
Signed-off-by: Julian Hall <julian.hall@arm.com>
Change-Id: I7356c0d1da23bc789090d3299b8e66f2e28ab979
diff --git a/tools/cmake/compiler/config_iface.cmake b/tools/cmake/compiler/config_iface.cmake
new file mode 100644
index 0000000..4afa799
--- /dev/null
+++ b/tools/cmake/compiler/config_iface.cmake
@@ -0,0 +1,15 @@
+#-------------------------------------------------------------------------------
+# Copyright (c) 2021, Arm Limited and Contributors. All rights reserved.
+#
+# SPDX-License-Identifier: BSD-3-Clause
+#
+#-------------------------------------------------------------------------------
+
+# This provides a common interface for injecting definitions and include paths
+# into a cmake build for the purpose of applying an externally defined
+# build configuration. Although some cmake based external components provide
+# their own cmake based configuration interface, not all do. This file gets
+# included by environment specific cmake toolchain files that get actioned
+# early on when a new cmake build context is created.
+add_definitions(${EXTERNAL_DEFINITIONS})
+include_directories(${EXTERNAL_INCLUDE_PATHS})