blob: c3eb4496d1d44992c7e015f266e2e413ae504a61 [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 ")
Mate Toth-Palbbb816d2024-08-01 10:41:35 +020020 string(APPEND CMAKE_${language}_FLAGS_INIT "-Wno-type-limits ")
Soby Mathew8487c472023-04-25 11:21:32 +010021 string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ")
Soby Mathewdff05e12024-12-31 16:30:17 +000022 string(APPEND CMAKE_${language}_FLAGS_INIT "-D_FORTIFY_SOURCE=2 ")
Soby Mathewa3e58e92024-12-31 15:40:36 +000023 string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og -Wnull-dereference ")
Soby Mathewb4c6df42022-11-09 11:13:29 +000024 string(APPEND CMAKE_${language}_FLAGS_RELEASE_INIT "-g ")
25endforeach()
26
Soby Mathew65caab72023-04-25 07:16:30 +010027string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections -g ")