Explicitly search for the C++ cross compiler
Although TFM is written entirely, it is (almost) possible to write
trusted applications in C++. However, the TFM build script, at least
for the gnuarm toolchain, only explicitly sets the C compiler not the
C++ compiler.
Without this set, Cmake tries to guess the C++ compiler, and depending
on the build environment seems to either choose the correct cross
compiler, or chooses the host C++ compiler, which results in confusing
compilation failures.
Fix this by explicitly setting the C++ compiler. This does not add a
test for this, because although most installs of armgcc will have a C++
compiler available, not everyone will be building with it, and it isn't
strictly required.
Signed-off-by: David Brown <david.brown@linaro.org>
Change-Id: Ia1b824dbbb12deb1cb153d84132533d13c417638
diff --git a/toolchain_GNUARM.cmake b/toolchain_GNUARM.cmake
index 8b66c5b..83eab4b 100644
--- a/toolchain_GNUARM.cmake
+++ b/toolchain_GNUARM.cmake
@@ -14,6 +14,7 @@
set(CMAKE_SYSTEM_NAME Generic)
find_program(CMAKE_C_COMPILER ${CROSS_COMPILE}-gcc)
+find_program(CMAKE_CXX_COMPILER ${CROSS_COMPILE}-g++)
if(CMAKE_C_COMPILER STREQUAL "CMAKE_C_COMPILER-NOTFOUND")
message(FATAL_ERROR "Could not find compiler: '${CROSS_COMPILE}-gcc'")