blob: 541cd891fd1766f0d30ea9b873ce0d481fc1d673 [file] [log] [blame]
Gyorgy Szing49091802020-11-24 00:33:09 +01001#-------------------------------------------------------------------------------
Gyorgy Szingd80f8562021-02-11 19:31:43 +01002# Copyright (c) 2020-2021, Arm Limited and Contributors. All rights reserved.
Gyorgy Szing49091802020-11-24 00:33:09 +01003#
4# SPDX-License-Identifier: BSD-3-Clause
5#
6#-------------------------------------------------------------------------------
7
8#GNUARM v8 and v9 compilers use a different triplet.
Gyorgy Szingd80f8562021-02-11 19:31:43 +01009if(NOT CROSS_COMPILE AND NOT DEFINED ENV{CROSS_COMPILE})
Gyorgy Szingdaf2efd2021-03-09 07:30:34 +010010 set(CROSS_COMPILE "aarch64-elf-;aarch64-none-elf-;aarch64-linux-gnu-;aarch64-none-linux-gnu-" CACHE STRING "List of GCC prefix triplets to use.")
Gyorgy Szing49091802020-11-24 00:33:09 +010011endif()
12
13set(CMAKE_CROSSCOMPILING True)
14set(CMAKE_SYSTEM_NAME Generic)
15set(CMAKE_SYSTEM_PROCESSOR arm)
16set(CMAKE_POSITION_INDEPENDENT_CODE True)
17
Gyorgy Szing49091802020-11-24 00:33:09 +010018include($ENV{TS_ROOT}/tools/cmake/compiler/GCC.cmake REQUIRED)
Julian Hall0051ed12021-07-22 13:59:24 +010019include($ENV{TS_ROOT}/tools/cmake/compiler/config_iface.cmake REQUIRED)
Andrew Beggs97a00d42021-06-15 15:45:46 +000020# Set mandatory compiler and linker flags for this environment:
Andrew Beggs97a00d42021-06-15 15:45:46 +000021# - Compile position independent code
22string(APPEND CMAKE_C_FLAGS_INIT " -fpic")
Imre Kis23583e32021-10-22 14:54:51 +020023# - Disable startup files and default libraries.
24# - Link position independent executable
Gyorgy Szing693877e2021-12-12 02:51:10 +010025string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " -pie")