1# 2# SPDX-License-Identifier: BSD-3-Clause 3# SPDX-FileCopyrightText: Copyright TF-RMM Contributors. 4# 5 6include_guard() 7 8set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) 9set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) 10set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) 11set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) 12 13foreach(language IN ITEMS ASM C CXX) 14 string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-common ") 15 string(APPEND CMAKE_${language}_FLAGS_INIT "-ffunction-sections ") 16 string(APPEND CMAKE_${language}_FLAGS_INIT "-fdata-sections ") 17 string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-delete-null-pointer-checks ") 18 string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror -Wstrict-overflow ") 19 string(APPEND CMAKE_${language}_FLAGS_INIT "-Wextra -Wno-implicit-fallthrough ") 20 string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ") 21 string(APPEND CMAKE_${language}_FLAGS_INIT "-D_FORTIFY_SOURCE=2 ") 22 string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og -Wnull-dereference -Wstrict-aliasing=1 ") 23 string(APPEND CMAKE_${language}_FLAGS_RELEASE_INIT "-g ") 24endforeach() 25 26string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections -g ") 27