[llvm] bd319d9 - [Cygwin] CYGWIN is not WIN32 in current CMake (#143130)
via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 13 17:42:42 PDT 2025
Author: Tomohiro Kashiwada
Date: 2025-06-13T17:42:39-07:00
New Revision: bd319d9071fb0c6e1bda9db500d039d32a49c28a
URL: https://github.com/llvm/llvm-project/commit/bd319d9071fb0c6e1bda9db500d039d32a49c28a
DIFF: https://github.com/llvm/llvm-project/commit/bd319d9071fb0c6e1bda9db500d039d32a49c28a.diff
LOG: [Cygwin] CYGWIN is not WIN32 in current CMake (#143130)
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.
Added:
Modified:
llvm/cmake/config-ix.cmake
llvm/cmake/modules/HandleLLVMOptions.cmake
Removed:
################################################################################
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()
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index c35d9763a3301..e2f9826d39818 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -217,15 +217,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)
More information about the llvm-commits
mailing list