aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGyorgy Szing <Gyorgy.Szing@arm.com>2021-02-11 19:31:43 +0100
committerGy├Ârgy Szing <gyorgy.szing@arm.com>2021-02-12 08:55:28 +0000
commitd80f856adf59dd606955ed78e3498649d131832a (patch)
tree01b907c9885aac21ded0a618ef6d2e0a62199d2b
parent1b631ebda1aa9a1031feabf0df7897df61713996 (diff)
downloadtrusted-services-d80f856adf59dd606955ed78e3498649d131832a.tar.gz
Fix: CROSS_COMPILE env variable is ignored
The "arm-linux" deployments ignore the CROSS_COMPILE environment variable which makes the build fail when the compiler is not on the PATH. This patch fixes this incorrect behavior and makes the "arm-linux" and the "opteesp" deployments aligned on how the environment variable is handled. The policy is to prefer any value already in the cache. If the variable is not in the cache, the value will be taken over from the environment. Change-Id: Id3cc4d6c23767d8ad9cb9657a582d6f70e191e37 Signed-off-by: Gyorgy Szing <Gyorgy.Szing@arm.com>
-rw-r--r--environments/arm-linux/default_toolchain_file.cmake6
-rw-r--r--environments/opteesp/default_toolchain_file.cmake4
2 files changed, 6 insertions, 4 deletions
diff --git a/environments/arm-linux/default_toolchain_file.cmake b/environments/arm-linux/default_toolchain_file.cmake
index bc04fdd..5ad7801 100644
--- a/environments/arm-linux/default_toolchain_file.cmake
+++ b/environments/arm-linux/default_toolchain_file.cmake
@@ -1,10 +1,12 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
-set(ENV{CROSS_COMPILE} "aarch64-linux-gnu-;aarch64-none-linux-gnu-")
+if(NOT CROSS_COMPILE AND NOT DEFINED ENV{CROSS_COMPILE})
+ set(CROSS_COMPILE "aarch64-elf-;aarch64-none-elf-;aarch64-linux-gnu-" CACHE STRING "List of GCC prefix triplets to use.")
+endif()
set(CMAKE_CROSSCOMPILING True)
set(CMAKE_SYSTEM_NAME Linux)
diff --git a/environments/opteesp/default_toolchain_file.cmake b/environments/opteesp/default_toolchain_file.cmake
index 76c78d7..76109ca 100644
--- a/environments/opteesp/default_toolchain_file.cmake
+++ b/environments/opteesp/default_toolchain_file.cmake
@@ -1,12 +1,12 @@
#-------------------------------------------------------------------------------
-# Copyright (c) 2020, Arm Limited and Contributors. All rights reserved.
+# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
#
# SPDX-License-Identifier: BSD-3-Clause
#
#-------------------------------------------------------------------------------
#GNUARM v8 and v9 compilers use a different triplet.
-if(NOT DEFINED ENV{CROSS_COMPILE})
+if(NOT CROSS_COMPILE AND NOT DEFINED ENV{CROSS_COMPILE})
set(CROSS_COMPILE "aarch64-elf-;aarch64-none-elf-;aarch64-linux-gnu-" CACHE STRING "List of GCC prefix triplets to use.")
endif()