blob: 412e1c146df4329411cb0b7bf4e76009950ae9bf (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
From e14502834fe6a9c6c9a439401ac3d2c8fd979267 Mon Sep 17 00:00:00 2001
From: Robert Yang <liezhi.yang@windriver.com>
Date: Sun, 8 Jun 2025 00:36:38 -0700
Subject: [PATCH] CMakeLists.txt: Improve checking for CFLAGS
The previous log wasn't clear:
-- Performing Test found
-- Performing Test found - Success
-- Performing Test found
-- Performing Test found - Success
-- Performing Test found
-- Performing Test found - Failed
Use a new var compiler-supports${flag} will make it more clear:
-- Performing Test compiler-supports-fno-strict-overflow
-- Performing Test compiler-supports-fno-strict-overflow - Success
-- Performing Test compiler-supports-fno-delete-null-pointer-checks
-- Performing Test compiler-supports-fno-delete-null-pointer-checks - Success
-- Performing Test compiler-supports-fhardened
-- Performing Test compiler-supports-fhardened - Failed
Upstream-Status: Backport [https://github.com/rpm-software-management/rpm/commit/e14502834fe6a9c6c9a439401ac3d2c8fd979267]
Signed-off-by: Robert Yang <liezhi.yang@windriver.com>
---
CMakeLists.txt | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 08e3e5274..f275c396b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -416,11 +416,10 @@ endif()
# try to ensure some compiler sanity and hardening options where supported
foreach (flag -fno-strict-overflow -fno-delete-null-pointer-checks -fhardened)
- check_c_compiler_flag(${flag} found)
- if (found)
+ check_c_compiler_flag(${flag} compiler-supports${flag})
+ if (compiler-supports${flag})
add_compile_options(${flag})
endif()
- unset(found)
endforeach()
# generated sources
|