blob: fe2f19c90f4337d75347b6b1e4519f56f96563d1 [file] [log] [blame]
Soby Mathewb4c6df42022-11-09 11:13:29 +00001#
2# SPDX-License-Identifier: BSD-3-Clause
3# SPDX-FileCopyrightText: Copyright TF-RMM Contributors.
4#
5
6include_guard()
7
Soby Mathewb4c6df42022-11-09 11:13:29 +00008set(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
Javier Almansa Sobrinoc4ad5b02022-07-05 19:05:14 +010013foreach(language IN ITEMS ASM C CXX)
Soby Mathewb4c6df42022-11-09 11:13:29 +000014 string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-common ")
Soby Mathewb4c6df42022-11-09 11:13:29 +000015 string(APPEND CMAKE_${language}_FLAGS_INIT "-ffunction-sections ")
16 string(APPEND CMAKE_${language}_FLAGS_INIT "-fdata-sections ")
Soby Mathewdff05e12024-12-31 16:30:17 +000017 string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror -Wstrict-overflow ")
Soby Mathew8487c472023-04-25 11:21:32 +010018 string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")
Soby Mathewdff05e12024-12-31 16:30:17 +000019 string(APPEND CMAKE_${language}_FLAGS_INIT "-D_FORTIFY_SOURCE=2 ")
Soby Mathewa3e58e92024-12-31 15:40:36 +000020 string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og -Wnull-dereference ")
Soby Mathewb4c6df42022-11-09 11:13:29 +000021 string(APPEND CMAKE_${language}_FLAGS_RELEASE_INIT "-g ")
22endforeach()
23
Soby Mathew65caab72023-04-25 07:16:30 +010024string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections -g ")