summaryrefslogtreecommitdiffstats
path: root/Source
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2021-04-28 13:49:32 (GMT)
committerKitware Robot <kwrobot@kitware.com>2021-04-28 13:49:41 (GMT)
commit11530e5504395c753fa23ce2b6c702c2d7e60602 (patch)
tree5edf437a5916d61b8f879374792d7e519b6f73d6 /Source
parent91788612450ca2d2fecda2c0f6ca9a323d0a8617 (diff)
parentc4941b7e66cd3a0a9de5ed8189ef025fcd6f3122 (diff)
downloadCMake-11530e5504395c753fa23ce2b6c702c2d7e60602.zip
CMake-11530e5504395c753fa23ce2b6c702c2d7e60602.tar.gz
CMake-11530e5504395c753fa23ce2b6c702c2d7e60602.tar.bz2
Merge topic 'ARMClang-cpu-arch-flags'
c4941b7e66 ARMClang: Do not automatically add cpu/arch compile or link options 0078db3888 ARMClang: Separate cpu/arch flags from preceding flags Acked-by: Kitware Robot <kwrobot@kitware.com> Acked-by: Jaeden Amero <kitware@patater.com> Merge-request: !6035
Diffstat (limited to 'Source')
-rw-r--r--Source/cmCoreTryCompile.cxx9
-rw-r--r--Source/cmPolicies.h5
2 files changed, 13 insertions, 1 deletions
diff --git a/Source/cmCoreTryCompile.cxx b/Source/cmCoreTryCompile.cxx
index cb84d1d..5399fd0 100644
--- a/Source/cmCoreTryCompile.cxx
+++ b/Source/cmCoreTryCompile.cxx
@@ -8,6 +8,7 @@
#include <sstream>
#include <utility>
+#include <cm/string_view>
#include <cmext/string_view>
#include "cmsys/Directory.hxx"
@@ -217,6 +218,7 @@ std::string const kCMAKE_POSITION_INDEPENDENT_CODE =
std::string const kCMAKE_SYSROOT = "CMAKE_SYSROOT";
std::string const kCMAKE_SYSROOT_COMPILE = "CMAKE_SYSROOT_COMPILE";
std::string const kCMAKE_SYSROOT_LINK = "CMAKE_SYSROOT_LINK";
+std::string const kCMAKE_ARMClang_CMP0123 = "CMAKE_ARMClang_CMP0123";
std::string const kCMAKE_TRY_COMPILE_OSX_ARCHITECTURES =
"CMAKE_TRY_COMPILE_OSX_ARCHITECTURES";
std::string const kCMAKE_TRY_COMPILE_PLATFORM_VARIABLES =
@@ -552,6 +554,13 @@ int cmCoreTryCompile::TryCompileCode(std::vector<std::string> const& argv,
fprintf(fout, "cmake_policy(SET CMP0104 OLD)\n");
}
+ /* Set ARMClang cpu/arch policy to match outer project. */
+ if (cmProp cmp0123 =
+ this->Makefile->GetDefinition(kCMAKE_ARMClang_CMP0123)) {
+ fprintf(fout, "cmake_policy(SET CMP0123 %s)\n",
+ *cmp0123 == "NEW"_s ? "NEW" : "OLD");
+ }
+
std::string projectLangs;
for (std::string const& li : testLangs) {
projectLangs += " " + li;
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) \