summaryrefslogtreecommitdiff
path: root/cmake
diff options
context:
space:
mode:
authorEdward Thomson <ethomson@edwardthomson.com>2021-11-10 21:58:12 -0500
committerEdward Thomson <ethomson@edwardthomson.com>2021-11-11 15:56:11 -0500
commit83fa548078b0b35030ba028676d6b5674d86ba18 (patch)
tree4c5108dbfb0a3dac8841d096ae862b880ca7d35c /cmake
parente35a22a080ad8127c1b3f058e6eea99d50fcfc79 (diff)
downloadlibgit2-83fa548078b0b35030ba028676d6b5674d86ba18.tar.gz
cmake: refactor WinHTTP selection
Move WinHTTP selection into its own cmake module.
Diffstat (limited to 'cmake')
-rw-r--r--cmake/SelectWinHTTP.cmake17
1 files changed, 17 insertions, 0 deletions
diff --git a/cmake/SelectWinHTTP.cmake b/cmake/SelectWinHTTP.cmake
new file mode 100644
index 000000000..a4110045f
--- /dev/null
+++ b/cmake/SelectWinHTTP.cmake
@@ -0,0 +1,17 @@
+if(WIN32 AND WINHTTP)
+ set(GIT_WINHTTP 1)
+
+ # Since MinGW does not come with headers or an import library for winhttp,
+ # we have to include a private header and generate our own import library
+ if(MINGW)
+ add_subdirectory("${libgit2_SOURCE_DIR}/deps/winhttp" "${libgit2_BINARY_DIR}/deps/winhttp")
+ list(APPEND LIBGIT2_LIBS winhttp)
+ list(APPEND LIBGIT2_DEPENDENCY_INCLUDES "${libgit2_SOURCE_DIR}/deps/winhttp")
+ else()
+ list(APPEND LIBGIT2_LIBS "winhttp")
+ list(APPEND LIBGIT2_PC_LIBS "-lwinhttp")
+ endif()
+
+ list(APPEND LIBGIT2_LIBS "rpcrt4" "crypt32" "ole32")
+ list(APPEND LIBGIT2_PC_LIBS "-lrpcrt4" "-lcrypt32" "-lole32")
+endif()