Skip to content

Commit f644c40

Browse files
kikairoyajeremyd2019
authored andcommitted
[Cygwin] CYGWIN is not WIN32 in current CMake (llvm#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 1c772d7 commit f644c40

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)
@@ -264,7 +259,7 @@ endif()
264259
# party code may call MSan interceptors like strlen, leading to false positives.
265260
if(NOT LLVM_USE_SANITIZER MATCHES "Memory.*")
266261
# Don't look for these libraries on Windows.
267-
if (NOT PURE_WINDOWS)
262+
if (NOT WIN32)
268263
# Skip libedit if using ASan as it contains memory leaks.
269264
if (LLVM_ENABLE_LIBEDIT AND NOT LLVM_USE_SANITIZER MATCHES ".*Address.*")
270265
if(LLVM_ENABLE_LIBEDIT STREQUAL FORCE_ON)
@@ -337,7 +332,7 @@ check_symbol_exists(sbrk unistd.h HAVE_SBRK)
337332
check_symbol_exists(strerror_r string.h HAVE_STRERROR_R)
338333
check_symbol_exists(strerror_s string.h HAVE_DECL_STRERROR_S)
339334
check_symbol_exists(setenv stdlib.h HAVE_SETENV)
340-
if( PURE_WINDOWS )
335+
if(WIN32)
341336
check_symbol_exists(_chsize_s io.h HAVE__CHSIZE_S)
342337

343338
check_function_exists(_alloca HAVE__ALLOCA)
@@ -373,8 +368,7 @@ else()
373368
"sys/types.h;sys/stat.h" HAVE_STRUCT_STAT_ST_MTIM_TV_NSEC)
374369
endif()
375370

376-
# This check requires _GNU_SOURCE.
377-
if (NOT PURE_WINDOWS)
371+
if (NOT WIN32)
378372
if (LLVM_PTHREAD_LIB)
379373
list(APPEND CMAKE_REQUIRED_LIBRARIES ${LLVM_PTHREAD_LIB})
380374
endif()

llvm/cmake/modules/HandleLLVMOptions.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -210,15 +210,15 @@ if( LLVM_REVERSE_ITERATION )
210210
set( LLVM_ENABLE_REVERSE_ITERATION 1 )
211211
endif()
212212

213-
if(WIN32)
213+
if(WIN32 OR CYGWIN)
214214
set(LLVM_HAVE_LINK_VERSION_SCRIPT 0)
215215
if(CYGWIN)
216216
set(LLVM_ON_WIN32 0)
217217
set(LLVM_ON_UNIX 1)
218-
else(CYGWIN)
218+
else()
219219
set(LLVM_ON_WIN32 1)
220220
set(LLVM_ON_UNIX 0)
221-
endif(CYGWIN)
221+
endif()
222222
elseif(FUCHSIA OR UNIX)
223223
set(LLVM_ON_WIN32 0)
224224
set(LLVM_ON_UNIX 1)

0 commit comments

Comments
 (0)