Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 1 | # |
| 2 | # SPDX-License-Identifier: BSD-3-Clause |
| 3 | # SPDX-FileCopyrightText: Copyright TF-RMM Contributors. |
| 4 | # |
| 5 | |
| 6 | include_guard() |
| 7 | |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 8 | set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) |
| 9 | set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) |
| 10 | set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) |
| 11 | set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) |
| 12 | |
Javier Almansa Sobrino | c4ad5b0 | 2022-07-05 19:05:14 +0100 | [diff] [blame] | 13 | foreach(language IN ITEMS ASM C CXX) |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 14 | string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-common ") |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 15 | string(APPEND CMAKE_${language}_FLAGS_INIT "-ffunction-sections ") |
| 16 | string(APPEND CMAKE_${language}_FLAGS_INIT "-fdata-sections ") |
Soby Mathew | 06c28c1 | 2025-01-02 13:00:48 +0000 | [diff] [blame] | 17 | string(APPEND CMAKE_${language}_FLAGS_INIT "-fno-delete-null-pointer-checks ") |
Soby Mathew | dff05e1 | 2024-12-31 16:30:17 +0000 | [diff] [blame] | 18 | string(APPEND CMAKE_${language}_FLAGS_INIT "-Wall -Werror -Wstrict-overflow ") |
Soby Mathew | b1228bb | 2024-12-31 17:42:46 +0000 | [diff] [blame] | 19 | string(APPEND CMAKE_${language}_FLAGS_INIT "-Wextra -Wno-implicit-fallthrough ") |
Soby Mathew | 8487c47 | 2023-04-25 11:21:32 +0100 | [diff] [blame] | 20 | string(APPEND CMAKE_${language}_FLAGS_INIT "-gdwarf-4 ") |
Soby Mathew | dff05e1 | 2024-12-31 16:30:17 +0000 | [diff] [blame] | 21 | string(APPEND CMAKE_${language}_FLAGS_INIT "-D_FORTIFY_SOURCE=2 ") |
Jacob Man Chun Yiu | d7089bd | 2025-01-28 15:56:51 +0000 | [diff] [blame] | 22 | string(APPEND CMAKE_${language}_FLAGS_DEBUG_INIT "-Og -Wnull-dereference -Wstrict-aliasing=1 ") |
Soby Mathew | b4c6df4 | 2022-11-09 11:13:29 +0000 | [diff] [blame] | 23 | string(APPEND CMAKE_${language}_FLAGS_RELEASE_INIT "-g ") |
| 24 | endforeach() |
| 25 | |
Soby Mathew | 65caab7 | 2023-04-25 07:16:30 +0100 | [diff] [blame] | 26 | string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT "-Wl,--gc-sections -g ") |