summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@github.com>2016-06-21 13:23:04 -0400
committerGitHub <noreply@github.com>2016-06-21 13:23:04 -0400
commit6944fd325db6c1f51f321459d37b1482c91207c7 (patch)
tree7ed509cebc9122dfbcc88a0b7a5cac2a5a5b53e9
parentbb0edf87ce33cbf454fa13490621230cb43d247b (diff)
parentb6a2fd0e0dbf5d2f45fd9307c7577f94b1e4d169 (diff)
downloadlibgit2-6944fd325db6c1f51f321459d37b1482c91207c7.tar.gz
Merge pull request #3833 from pks-t/pks/msys-conditional-fpic
cmake: do not use -fPIC for MSYS2
-rw-r--r--CMakeLists.txt14
1 files changed, 8 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b8082d501..93a9e47c1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -473,19 +473,21 @@ ELSE ()
SET(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -D_DEBUG")
ENDIF ()
- IF (MINGW) # MinGW always does PIC and complains if we tell it to
+ IF (MINGW OR MSYS) # MinGW and MSYS always do PIC and complain if we tell them to
STRING(REGEX REPLACE "-fPIC" "" CMAKE_SHARED_LIBRARY_C_FLAGS "${CMAKE_SHARED_LIBRARY_C_FLAGS}")
- # MinGW >= 3.14 uses the C99-style stdio functions
- # automatically, but forks like mingw-w64 still want
- # us to define this in order to use them
- ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
-
ELSEIF (BUILD_SHARED_LIBS)
ADD_C_FLAG_IF_SUPPORTED(-fvisibility=hidden)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
ENDIF ()
+ IF (MINGW)
+ # MinGW >= 3.14 uses the C99-style stdio functions
+ # automatically, but forks like mingw-w64 still want
+ # us to define this in order to use them
+ ADD_DEFINITIONS(-D__USE_MINGW_ANSI_STDIO=1)
+ ENDIF ()
+
ADD_C_FLAG_IF_SUPPORTED(-Wdocumentation)
ADD_C_FLAG_IF_SUPPORTED(-Wno-missing-field-initializers)
ADD_C_FLAG_IF_SUPPORTED(-Wstrict-aliasing=2)