Skip to content

Commit

Permalink
Can now build libgit2 as a package on Windows (#1306).
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed May 9, 2017
1 parent 5185adf commit 147e9fa
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
18 changes: 8 additions & 10 deletions src/plugins/thirdParty/libgit2/CMakeLists.txt
Expand Up @@ -12,13 +12,8 @@ SET(FULL_LOCAL_EXTERNAL_PACKAGE_DIR ${PROJECT_SOURCE_DIR}/${LOCAL_EXTERNAL_PACKA
# Name of our package's shared library (and of its import library, if any)

IF(WIN32)
IF(RELEASE_MODE)
SET(PACKAGE_SHARED_LIBRARY libgit2${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(PACKAGE_IMPORT_LIBRARY libgit2${CMAKE_IMPORT_LIBRARY_SUFFIX})
ELSE()
SET(PACKAGE_SHARED_LIBRARY libgit2d${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(PACKAGE_IMPORT_LIBRARY libgit2d${CMAKE_IMPORT_LIBRARY_SUFFIX})
ENDIF()
SET(PACKAGE_SHARED_LIBRARY git2${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(PACKAGE_IMPORT_LIBRARY git2${CMAKE_IMPORT_LIBRARY_SUFFIX})
ELSEIF(APPLE)
SET(PACKAGE_SHARED_LIBRARY ${CMAKE_SHARED_LIBRARY_PREFIX}git2.${PACKAGE_MAJOR_VERSION}${CMAKE_SHARED_LIBRARY_SUFFIX})
SET(PACKAGE_IMPORT_LIBRARY ${PACKAGE_SHARED_LIBRARY})
Expand Down Expand Up @@ -87,8 +82,10 @@ ELSE()

# Ignore some warnings

IF(APPLE)
SET(LIBGIT2_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
IF(WIN32)
SET(PACKAGE_C_FLAGS "${CMAKE_C_FLAGS} /wd4244 /wd4267 /wd4311 /wd4312")
ELSEIF(APPLE)
SET(PACKAGE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format")
ENDIF()

# Build libgit2 as an external project
Expand All @@ -105,12 +102,13 @@ ELSE()
GIT_TAG
maint/v0.25
CMAKE_CACHE_ARGS
-DCMAKE_C_FLAGS:STRING=${LIBGIT2_C_FLAGS}
-DCMAKE_C_FLAGS:STRING=${PACKAGE_C_FLAGS}
CMAKE_ARGS
-DBUILD_CLAR=OFF
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_MACOSX_RPATH=1
-DSTATIC_CRT=OFF
BUILD_BYPRODUCTS
<INSTALL_DIR>/lib/${PACKAGE_IMPORT_LIBRARY}
)
Expand Down
4 changes: 2 additions & 2 deletions src/plugins/thirdParty/zlib/CMakeLists.txt
Expand Up @@ -88,7 +88,7 @@ ELSE()
# Ignore some warnings

IF(WIN32)
SET(ZLIB_C_FLAGS "${CMAKE_C_FLAGS} /wd4267")
SET(PACKAGE_C_FLAGS "${CMAKE_C_FLAGS} /wd4267")
ENDIF()

# Build zlib as an external project
Expand All @@ -107,7 +107,7 @@ ELSE()
PATCH_COMMAND
${CMAKE_COMMAND} -E remove <SOURCE_DIR>/zconf.h
CMAKE_CACHE_ARGS
-DCMAKE_C_FLAGS:STRING=${ZLIB_C_FLAGS}
-DCMAKE_C_FLAGS:STRING=${PACKAGE_C_FLAGS}
CMAKE_ARGS
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
Expand Down

0 comments on commit 147e9fa

Please sign in to comment.