Skip to content

Commit 6944fd3

Browse files
author
Edward Thomson
authored
Merge pull request libgit2#3833 from pks-t/pks/msys-conditional-fpic
cmake: do not use -fPIC for MSYS2
2 parents bb0edf8 + b6a2fd0 commit 6944fd3

File tree

1 file changed

+8
-6
lines changed

1 file changed

+8
-6
lines changed

CMakeLists.txt

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -473,19 +473,21 @@ ELSE ()
473473
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
474474
ENDIF ()
475475

476-
IF (MINGW) # MinGW always does PIC and complains if we tell it to
476+
IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
477477
STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
478-
# MinGW >= 3.14 uses the C99-style stdio functions
479-
# automatically, but forks like mingw-w64 still want
480-
# us to define this in order to use them
481-
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
482-
483478
ELSEIF (BUILD_SHARED_LIBS)
484479
ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
485480

486481
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
487482
ENDIF ()
488483

484+
IF (MINGW)
485+
# MinGW >= 3.14 uses the C99-style stdio functions
486+
# automatically, but forks like mingw-w64 still want
487+
# us to define this in order to use them
488+
ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
489+
ENDIF ()
490+
489491
ADD_C_FLAG_IF_SUPPORTED(-Wdocumentation)
490492
ADD_C_FLAG_IF_SUPPORTED(-Wno-missing-field-initializers)
491493
ADD_C_FLAG_IF_SUPPORTED(-Wstrict-aliasing=2)

0 commit comments

Comments
 (0)