- if possible on Linux compilers, force static linking of libcurl

This commit is contained in:
Mark Vejvoda 2011-01-04 01:40:47 +00:00
parent 5f831db095
commit a36f0c38d6
1 changed files with 18 additions and 0 deletions

View File

@ -19,8 +19,26 @@ INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARY CURL_INCLUDE_DIR)
IF(CURL_FOUND)
SET(CURL_LIBRARIES ${CURL_LIBRARY})
SET(CURL_INCLUDE_DIRS ${CURL_INCLUDE_DIR})
# IF we are using a system that supports curl-config use it
# and force using static libs
IF(UNIX AND NOT APPLE)
FIND_PROGRAM( CMAKE_CURL_CONFIG curl-config)
IF(CMAKE_CURL_CONFIG)
# run the curl-config program to get --static-libs
EXEC_PROGRAM(sh
ARGS "${CMAKE_CURL_CONFIG} --static-libs"
OUTPUT_VARIABLE CURL_STATIC_LIBS
RETURN_VALUE RET)
SET(CURL_LIBRARIES "-static ${CURL_STATIC_LIBS}")
ENDIF()
ENDIF()
ELSE(CURL_FOUND)
SET(CURL_LIBRARIES)
SET(CURL_INCLUDE_DIRS)