Skip to content

Commit bd319d9

Browse files
authored
[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.
1 parent 15f100d commit bd319d9

File tree

2 files changed

+8
-14
lines changed

2 files changed

+8
-14
lines changed

llvm/cmake/config-ix.cmake

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,3 @@
1-
if( WIN32 AND NOT CYGWIN )
2-
# We consider Cygwin as another Unix
3-
set(PURE_WINDOWS 1)
4-
endif()
5-
61
include(CheckIncludeFile)
72
include(CheckLibraryExists)
83
include(CheckSymbolExists)
@@ -31,7 +26,7 @@ elseif (APPLE)
3126
set(HAVE_SYS_MMAN_H 1)
3227
set(HAVE_SYSEXITS_H 1)
3328
set(HAVE_UNISTD_H 1)
34-
elseif (PURE_WINDOWS)
29+
elseif (WIN32)
3530
set(HAVE_MACH_MACH_H 0)
3631
set(HAVE_MALLOC_MALLOC_H 0)
3732
set(HAVE_PTHREAD_H 0)
@@ -132,7 +127,7 @@ if(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
132127
endif()
133128

134129
# library checks
135-
if( NOT PURE_WINDOWS )
130+
if(NOT WIN32)
136131
check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD)
137132
if (HAVE_LIBPTHREAD)
138133
check_library_exists(pthread pthread_rwlock_init "" HAVE_PTHREAD_RWLOCK_INIT)
@@ -275,7 +270,7 @@ endif()
275270
# party code may call MSan interceptors like strlen, leading to false positives.
276271
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
277272
# Don't look for these libraries on Windows.
278-
if (NOT PURE_WINDOWS)
273+
if (NOT WIN32)
279274
# Skip libedit if using ASan as it contains memory leaks.
280275
if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
281276
if(LLVM_ENABLE_LIBEDIT STREQUAL FORCE_ON)
@@ -384,7 +379,7 @@ check_symbol_exists(sbrk unistd.h HAVE_SBRK)
384379
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
385380
check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S)
386381
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
387-
if( PURE_WINDOWS )
382+
if(WIN32)
388383
check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S)
389384

390385
check_function_exists(_alloca HAVE__ALLOCA)
@@ -420,8 +415,7 @@ else()
420415
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
421416
endif()
422417

423-
# This check requires _GNU_SOURCE.
424-
if (NOT PURE_WINDOWS)
418+
if (NOT WIN32)
425419
if (LLVM_PTHREAD_LIB)
426420
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB})
427421
endif()

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -217,15 +217,15 @@ if( LLVM_REVERSE_ITERATION )
217217
set( LLVM_ENABLE_REVERSE_ITERATION 1 )
218218
endif()
219219

220-
if(WIN32)
220+
if(WIN32 OR CYGWIN)
221221
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
222222
if(CYGWIN)
223223
set(LLVM_ON_WIN32 0)
224224
set(LLVM_ON_UNIX 1)
225-
else(CYGWIN)
225+
else()
226226
set(LLVM_ON_WIN32 1)
227227
set(LLVM_ON_UNIX 0)
228-
endif(CYGWIN)
228+
endif()
229229
elseif(FUCHSIA OR UNIX)
230230
set(LLVM_ON_WIN32 0)
231231
set(LLVM_ON_UNIX 1)

0 commit comments

Comments
 (0)