summaryrefslogtreecommitdiffstats
path: root/Tests/RunCMake/AppleSilicon/default.c
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2020-12-09 15:28:03 (GMT)
committerBrad King <brad.king@kitware.com>2020-12-10 17:08:15 (GMT)
commitb7f0327dcd4032c6a118825adcfdc8dab6295e7f (patch)
tree11acc0447f4c3e16e321f74de9a8fc2006f16dcd /Tests/RunCMake/AppleSilicon/default.c
parent5f882f6ce518a9f90600ae5c73f633ca5c15a7e5 (diff)
downloadCMake-b7f0327dcd4032c6a118825adcfdc8dab6295e7f.zip
CMake-b7f0327dcd4032c6a118825adcfdc8dab6295e7f.tar.gz
CMake-b7f0327dcd4032c6a118825adcfdc8dab6295e7f.tar.bz2
Tests: Cover macOS host architecture selection on Apple Silicon hosts
Add test cases verifying that `CMAKE_APPLE_SILICON_PROCESSOR` set as either a cache or environment variable causes that to be selected as the host architecture. Also verify that sources compile using whatever is selected as the host architecture, even when the explicit setting is not used. Issue: #21554
Diffstat (limited to 'Tests/RunCMake/AppleSilicon/default.c')
-rw-r--r--Tests/RunCMake/AppleSilicon/default.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/Tests/RunCMake/AppleSilicon/default.c b/Tests/RunCMake/AppleSilicon/default.c
new file mode 100644
index 0000000..7b0535b
--- /dev/null
+++ b/Tests/RunCMake/AppleSilicon/default.c
@@ -0,0 +1,14 @@
+#if defined(HOST_ARM64)
+# if !defined(__aarch64__)
+# error "Not compiling as host arm64"
+# endif
+#elif defined(HOST_X86_64)
+# if !defined(__x86_64__)
+# error "Not compiling as host x86_64"
+# endif
+#else
+# error "One of HOST_ARM64 or HOST_X86_64 must be defined."
+#endif
+void default_arch(void)
+{
+}