CMakeLists.txt 746 Bytes
Newer Older
1 2 3 4 5
FIND_PROGRAM(DLLTOOL dlltool CMAKE_FIND_ROOT_PATH_BOTH)
IF (NOT DLLTOOL)
	MESSAGE(FATAL_ERROR "Could not find dlltool command")
ENDIF ()

6
SET(LIBWINHTTP_PATH "${libgit2_BINARY_DIR}/deps/winhttp")
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26
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
)