[llvm] [Cygwin] CYGWIN is not WIN32 in current CMake (PR #143130)
Tomohiro Kashiwada via llvm-commits
llvm-commits at lists.llvm.org
Tue Jun 10 06:12:46 PDT 2025
https://github.com/kikairoya updated https://github.com/llvm/llvm-project/pull/143130
>From 3cacbfcbdc53208812b582dfab29f78a59e2ec61 Mon Sep 17 00:00:00 2001
From: kikairoya <kikairoya at gmail.com>
Date: Mon, 28 Apr 2025 19:26:29 +0900
Subject: [PATCH 1/2] [Cygwin] CYGWIN is not WIN32 in current CMake
On old CMake, Cygwin were also WIN32 but currently not.
LLVM_ON_UNIX=1 and LLVM_HAVE_LINK_VERSION_SCRIPT=0 should
be defined for Cygwin target.
---
llvm/cmake/modules/HandleLLVMOptions.cmake | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 9721dacbcbe84..866f5b8d9697a 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -214,15 +214,15 @@ if( LLVM_REVERSE_ITERATION )
set( LLVM_ENABLE_REVERSE_ITERATION 1 )
endif()
-if(WIN32)
+if(WIN32 OR CYGWIN)
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
if(CYGWIN)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
- else(CYGWIN)
+ else()
set(LLVM_ON_WIN32 1)
set(LLVM_ON_UNIX 0)
- endif(CYGWIN)
+ endif()
elseif(FUCHSIA OR UNIX)
set(LLVM_ON_WIN32 0)
set(LLVM_ON_UNIX 1)
>From 99309aefa3a5140d3bde9ce20b2648a5bbb8fd08 Mon Sep 17 00:00:00 2001
From: kikairoya <kikairoya at gmail.com>
Date: Tue, 10 Jun 2025 21:38:14 +0900
Subject: [PATCH 2/2] Update: llvm/cmake/config-ix.cmake: ditto.
---
llvm/cmake/config-ix.cmake | 16 +++++-----------
1 file changed, 5 insertions(+), 11 deletions(-)
diff --git a/llvm/cmake/config-ix.cmake b/llvm/cmake/config-ix.cmake
index 687f5077cbfd2..9895469973e47 100644
--- a/llvm/cmake/config-ix.cmake
+++ b/llvm/cmake/config-ix.cmake
@@ -1,8 +1,3 @@
-if( WIN32 AND NOT CYGWIN )
- # We consider Cygwin as another Unix
- set(PURE_WINDOWS 1)
-endif()
-
include(CheckIncludeFile)
include(CheckLibraryExists)
include(CheckSymbolExists)
@@ -31,7 +26,7 @@ elseif (APPLE)
set(HAVE_SYS_MMAN_H 1)
set(HAVE_SYSEXITS_H 1)
set(HAVE_UNISTD_H 1)
-elseif (PURE_WINDOWS)
+elseif (WIN32)
set(HAVE_MACH_MACH_H 0)
set(HAVE_MALLOC_MALLOC_H 0)
set(HAVE_PTHREAD_H 0)
@@ -132,7 +127,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
endif()
# library checks
-if( NOT PURE_WINDOWS )
+if(NOT WIN32)
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
if (HAVE_LIBPTHREAD)
check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
@@ -275,7 +270,7 @@ endif()
# party code may call MSan interceptors like strlen, leading to false positives.
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
# Don't look for these libraries on Windows.
- if (NOT PURE_WINDOWS)
+ if (NOT WIN32)
# Skip libedit if using ASan as it contains memory leaks.
if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
if(LLVM_ENABLE_LIBEDIT STREQUAL FORCE_ON)
@@ -384,7 +379,7 @@ check_symbol_exists(sbrk unistd.h HAVE_SBRK)
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S)
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
-if( PURE_WINDOWS )
+if(WIN32)
check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S)
check_function_exists(_alloca HAVE__ALLOCA)
@@ -420,8 +415,7 @@ else()
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
endif()
-# This check requires _GNU_SOURCE.
-if (NOT PURE_WINDOWS)
+if (NOT WIN32)
if (LLVM_PTHREAD_LIB)
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB})
endif()
More information about the llvm-commits
mailing list