summaryrefslogtreecommitdiffstats
path: root/Source/cmPolicies.h
diff options
context:
space:
mode:
authorLingkai Dong <lingkai.dong@arm.com>2021-04-21 16:07:22 (GMT)
committerBrad King <brad.king@kitware.com>2021-04-27 18:03:15 (GMT)
commitc4941b7e66cd3a0a9de5ed8189ef025fcd6f3122 (patch)
treec5158533c814362581c1423834fd2238d529e266 /Source/cmPolicies.h
parent0078db3888e01343d26c1f695b250663bbcb7ac2 (diff)
downloadCMake-c4941b7e66cd3a0a9de5ed8189ef025fcd6f3122.zip
CMake-c4941b7e66cd3a0a9de5ed8189ef025fcd6f3122.tar.gz
CMake-c4941b7e66cd3a0a9de5ed8189ef025fcd6f3122.tar.bz2
ARMClang: Do not automatically add cpu/arch compile or link options
The compile options `--march=<arch>` and `--mcpu=<cpu>` and the link option `--cpu=<cpu>` are automatically added by CMake based on `CMAKE_SYSTEM_PROCESSOR` or `CMAKE_SYSTEM_ARCH`. But this is not sufficient, because armclang also supports enabling or disabling features using `+<feature>`: -mcpu=<name>[+[no]<feature>+...] For example: -mcpu=cortex-a57+nocrypto+nofp+nosimd+crc (Reference: https://developer.arm.com/documentation/dui0774/k/Compiler-Command-line-Options/-mcpu?lang=en) The problem is, even if a project adds a flag with features it needs, CMake still adds flags, resulting in code that is compiled with wrong CPU features and unable to run. Add policy `CMP0123` to not automatically add compile or link options, and let projects set them instead. Co-Author: Brad King <brad.king@kitware.com> Fixes: #21173
Diffstat (limited to 'Source/cmPolicies.h')
-rw-r--r--Source/cmPolicies.h5
1 files changed, 4 insertions, 1 deletions
diff --git a/Source/cmPolicies.h b/Source/cmPolicies.h
index d546b6e..0a5bb4b 100644
--- a/Source/cmPolicies.h
+++ b/Source/cmPolicies.h
@@ -366,7 +366,10 @@ class cmMakefile;
SELECT( \
POLICY, CMP0122, \
"UseSWIG use standard library name conventions for csharp language.", 3, \
- 21, 0, cmPolicies::WARN)
+ 21, 0, cmPolicies::WARN) \
+ SELECT(POLICY, CMP0123, \
+ "ARMClang cpu/arch compile and link flags must be set explicitly.", \
+ 3, 21, 0, cmPolicies::WARN)
#define CM_SELECT_ID(F, A1, A2, A3, A4, A5, A6) F(A1)
#define CM_FOR_EACH_POLICY_ID(POLICY) \