summaryrefslogtreecommitdiff
path: root/deps
diff options
context:
space:
mode:
authorPatrick Steinhardt <ps@pks.im>2017-06-28 13:21:09 +0200
committerPatrick Steinhardt <ps@pks.im>2017-08-16 07:12:38 +0200
commit432485001593d25c6900acbd17f089e056ce91d2 (patch)
treea3cbee66cb38017b8f968a2ffc8bf9cd987a7b72 /deps
parentbed7ca3a3d73b06c2f97d10376607c022550aef3 (diff)
downloadlibgit2-432485001593d25c6900acbd17f089e056ce91d2.tar.gz
cmake: move winhttp build instructions into subdirectory
Extract code required to build the winhttp library into its own CMakeLists.txt, which is included as required.
Diffstat (limited to 'deps')
-rw-r--r--deps/winhttp/CMakeLists.txt26
1 files changed, 26 insertions, 0 deletions
diff --git a/deps/winhttp/CMakeLists.txt b/deps/winhttp/CMakeLists.txt
new file mode 100644
index 000000000..baa9fe2f0
--- /dev/null
+++ b/deps/winhttp/CMakeLists.txt
@@ -0,0 +1,26 @@
+FIND_PROGRAM(DLLTOOL dlltool CMAKE_FIND_ROOT_PATH_BOTH)
+IF (NOT DLLTOOL)
+ MESSAGE(FATAL_ERROR "Could not find dlltool command")
+ENDIF ()
+
+SET(LIBWINHTTP_PATH "${CMAKE_BINARY_DIR}/deps/winhttp")
+SET(LIBWINHTTP_PATH ${LIBWINHTTP_PATH} PARENT_SCOPE)
+FILE(MAKE_DIRECTORY ${LIBWINHTTP_PATH})
+
+IF (CMAKE_SIZEOF_VOID_P EQUAL 8)
+ set(WINHTTP_DEF "winhttp64.def")
+ELSE()
+ set(WINHTTP_DEF "winhttp.def")
+ENDIF()
+
+ADD_CUSTOM_COMMAND(
+ OUTPUT ${LIBWINHTTP_PATH}/libwinhttp.a
+ COMMAND ${DLLTOOL} -d ${WINHTTP_DEF} -k -D winhttp.dll -l libwinhttp.a
+ DEPENDS ${WINHTTP_DEF}
+ WORKING_DIRECTORY ${LIBWINHTTP_PATH}
+)
+
+SET_SOURCE_FILES_PROPERTIES(
+ ${CMAKE_CURRENT_SOURCE_DIR}/src/transports/winhttp.c
+ PROPERTIES OBJECT_DEPENDS ${LIBWINHTTP_PATH}/libwinhttp.a
+)