blob: 85baf3df2f59d9f91fdecfbaa3d626d4ed40ed05 [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 Mathew06c28c12025-01-02 13:00:48 +000017 string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-delete-null-pointer-checks ")
Soby Mathewdff05e12024-12-31 16:30:17 +000018 string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror -Wstrict-overflow ")
Soby Mathewb1228bb2024-12-31 17:42:46 +000019 string(APPEND CMAKE_${language}_FLAGS_INIT "-Wextra -Wno-implicit-fallthrough ")
Soby Mathew8487c472023-04-25 11:21:32 +010020 string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")
Soby Mathewdff05e12024-12-31 16:30:17 +000021 string(APPEND CMAKE_${language}_FLAGS_INIT "-D_FORTIFY_SOURCE=2 ")
Jacob Man Chun Yiud7089bd2025-01-28 15:56:51 +000022 string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og -Wnull-dereference -Wstrict-aliasing=1 ")
Soby Mathewb4c6df42022-11-09 11:13:29 +000023 string(APPEND CMAKE_${language}_FLAGS_RELEASE_INIT "-g ")
24endforeach()
25
Soby Mathew65caab72023-04-25 07:16:30 +010026string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections -g ")