[PATCH] Cygport: support CMAKE_SYSTEM_PROCESSOR when cross compiling with aarch64-w64-mingw32

Carlo B. carlo.bramini@gmail.com
Fri Feb 21 10:49:04 GMT 2025


Hello,
with reference to this thread:

https://cygwin.com/pipermail/cygwin/2024-July/256237.html

I added support for setting CMAKE_SYSTEM_PROCESSOR when cross
compiling packages with Cygport.
Until now, this fix allowed me to build all packages that I need with
my new cross compilers.

I hope that you will find this patch useful.
Sincerely,

Carlo Bramini.
-------------- next part --------------
diff --git a/cygclass/cmake.cygclass b/cygclass/cmake.cygclass
index d2a7ef0..e859be0 100644
--- a/cygclass/cmake.cygclass
+++ b/cygclass/cmake.cygclass
@@ -82,6 +82,20 @@ __cmake_system() {
 	echo -n ${cmsys}
 }
 
+__cmake_processor() {
+	local cmproc
+
+	case ${CHOST} in
+	x86_64-*)         cmproc="x86_64" ;;
+	i586-*)           cmproc="i586" ;;
+	i686-*)           cmproc="i686" ;;
+	aarch64-*)        cmproc="aarch64" ;;
+	*)                cmproc="" ;;
+	esac
+
+	echo -n ${cmproc}
+}
+
 #****C* cmake.cygclass/cygcmake
 #  SYNOPSIS
 #  cygcmake [OPTIONS]
@@ -102,7 +116,7 @@ __cmake_system() {
 #  cmake
 #****
 cygcmake() {
-	local buildtype cmdir crossargs exeext;
+	local buildtype cmdir crossargs exeext cmproc;
 
 	check_prog_req cmake;
 
@@ -146,6 +160,13 @@ cygcmake() {
 			-DCMAKE_FIND_ROOT_PATH=$(${CC} -print-sysroot)
 			-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
 			-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY"
+		cmproc=$(__cmake_processor)
+		if [ -z ${cmproc} ]
+		then
+			warning "CMAKE_SYSTEM_PROCESSOR is undefined. Please add support for ${CHOST}."
+		else
+			crossargs+=" -DCMAKE_SYSTEM_PROCESSOR=${cmproc}"
+		fi
 		case ${CHOST} in *-cygwin*|*-mingw*)
 			crossargs+=" -DCMAKE_RC_COMPILER=$(which ${CHOST}-windres${exeext})"
 			;;


More information about the Cygwin-apps mailing list