Skip to content

Commit

Permalink
cmake/curl: fix win32 build
Browse files Browse the repository at this point in the history
also use archive instead of Git
  • Loading branch information
karolherbst committed Aug 19, 2013
1 parent 31da87b commit a5a0e26
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 10 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ else()
endif()

###############################################################################
# SVN, Git, HTTP stuff
# SVN, HTTP stuff
###############################################################################

if(WIN32)
Expand Down Expand Up @@ -268,8 +268,6 @@ else()
endif()

# for windows
set(CURL_GIT git://github.com/bagder/curl.git)
set(CURL_VERSION tags/curl-7_25_0)
set(V8_SVN http://v8.googlecode.com/svn/tags/3.9.15/)

###############################################################################
Expand Down
31 changes: 24 additions & 7 deletions cmake/modules/BuildCURL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,21 @@ else()
set(BUILD_WITH_ARES --disable-ares)
endif()

if(DEBUG)
set(CURL_DEBUG yes)
else()
set(CURL_DEBUG no)
endif()

# we need OpenSSL on all targets
find_package(OpenSSL REQUIRED)
if(WIN32 AND NOT MINGW)
ExternalProject_Add(
curl
GIT_REPOSITORY ${CURL_GIT}
GIT_TAG ${CURL_VERSION}
URL ${CURL_URL}
URL_MD5 ${CURL_MD5}
UPDATE_COMMAND ""
CONFIGURE_COMMAND buildconf.bat
CONFIGURE_COMMAND ""
BUILD_IN_SOURCE 1
BUILD_COMMAND ""
INSTALL_COMMAND ""
Expand All @@ -24,17 +32,20 @@ if(WIN32 AND NOT MINGW)
custom_build
DEPENDEES configure
DEPENDERS build
COMMAND nmake /f Makefile.vc MODE=static WITH_SSL=yes DEBUG=no GEN_PDB=no USE_SSPI=no USE_IPV6=no ENABLE_IDN=no
COMMAND nmake /f Makefile.vc MODE=dll WITH_SSL=static DEBUG=${CURL_DEBUG} GEN_PDB=no USE_SSPI=no USE_IPV6=no USE_IDN=no WITH_DEVEL=${OPENSSL_INCLUDE_DIR}/..
WORKING_DIRECTORY <SOURCE_DIR>/winbuild
)

ExternalProject_Get_Property(
curl
source_dir
)
set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-release-static/)
if(DEBUG)
set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-debug-dll-ssl-static/)
else()
set(CURL_INSTALL_DIR ${source_dir}/builds/libcurl-release-dll-ssl-static/)
endif()
else()
find_package(OpenSSL REQUIRED)
set(CURL_INSTALL_DIR ${CMAKE_EXTERNAL_BINARY_DIR}/curl)
ExternalProject_Add(
curl
Expand All @@ -60,7 +71,13 @@ set(CURL_LIBRARY_DIR ${CURL_INSTALL_DIR}/lib)
set(CURL_INCLUDE_DIRS ${CURL_INSTALL_DIR}/include)

if(WIN32 AND NOT MINGW)
list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl_a.lib")
if(DEBUG)
list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl_debug.lib")
install(FILES "${CURL_BIN_DIRS}/libcurl_debug.dll" DESTINATION ${LIB_INSTALL_DIR})
else()
list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl.lib")
install(FILES "${CURL_BIN_DIRS}/libcurl.dll" DESTINATION ${LIB_INSTALL_DIR})
endif()
else()
list(APPEND CURL_LIBRARIES "${CURL_LIBRARY_DIR}/libcurl.a")
list(APPEND CURL_LIBRARIES "${OPENSSL_LIBRARIES}")
Expand Down

0 comments on commit a5a0e26

Please sign in to comment.