project( CURL C )
-
file (READ ${CURL_SOURCE_DIR}/include/curl/curlver.h CURL_VERSION_H_CONTENTS)
string (REGEX MATCH "LIBCURL_VERSION_MAJOR[ \t]+([0-9]+)"
LIBCURL_VERSION_MJ ${CURL_VERSION_H_CONTENTS})
endif(WIN32)
# This macro checks if the symbol exists in the library and if it
-# does, it appends library to the list.
+# does, it prepends library to the list.
macro(CHECK_LIBRARY_EXISTS_CONCAT LIBRARY SYMBOL VARIABLE)
- check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} ""
+ check_library_exists("${LIBRARY};${CURL_LIBS}" ${SYMBOL} "${CMAKE_LIBRARY_PATH}"
${VARIABLE})
if(${VARIABLE})
- set(CURL_LIBS ${CURL_LIBS} ${LIBRARY})
+ set(CURL_LIBS ${LIBRARY} ${CURL_LIBS})
endif(${VARIABLE})
endmacro(CHECK_LIBRARY_EXISTS_CONCAT)
# CHECK_LIBRARY_EXISTS_CONCAT("z" inflateEnd HAVE_LIBZ)
# ENDIF(NOT CURL_SPECIAL_LIBZ)
-option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
-mark_as_advanced(CMAKE_USE_OPENSSL)
-if(CMAKE_USE_OPENSSL)
- if(WIN32)
- find_package(OpenSSL)
- if(OPENSSL_FOUND)
- set(USE_SSLEAY TRUE)
- set(USE_OPENSSL TRUE)
- list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} )
- else()
- set(CMAKE_USE_OPENSSL FALSE)
- message(STATUS "OpenSSL NOT Found, disabling CMAKE_USE_OPENSSL")
- endif()
- else(WIN32)
- check_library_exists_concat("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
- check_library_exists_concat("ssl" SSL_connect HAVE_LIBSSL)
- endif(WIN32)
-endif(CMAKE_USE_OPENSSL)
-
# Check for idn
check_library_exists_concat("idn" idna_to_ascii_lz HAVE_LIBIDN)
endif()
endif()
+option(CMAKE_USE_OPENSSL "Use OpenSSL code. Experimental" ON)
+mark_as_advanced(CMAKE_USE_OPENSSL)
+if(CMAKE_USE_OPENSSL)
+ if(WIN32)
+ find_package(OpenSSL)
+ if(OPENSSL_FOUND)
+ set(USE_SSLEAY TRUE)
+ set(USE_OPENSSL TRUE)
+ list(APPEND CURL_LIBS ${OPENSSL_LIBRARIES} )
+ else()
+ set(CMAKE_USE_OPENSSL FALSE)
+ message(STATUS "OpenSSL NOT Found, disabling CMAKE_USE_OPENSSL")
+ endif()
+ else(WIN32)
+ check_library_exists_concat("crypto" CRYPTO_lock HAVE_LIBCRYPTO)
+ check_library_exists_concat("ssl" SSL_connect HAVE_LIBSSL)
+ endif(WIN32)
+endif(CMAKE_USE_OPENSSL)
+
# If we have features.h, then do the _BSD_SOURCE magic
check_include_file("features.h" HAVE_FEATURES_H)
if(NOT CURL_CONFIG_HAS_BEEN_RUN_BEFORE)
set(CURL_CONFIG_HAS_BEEN_RUN_BEFORE 1 CACHE INTERNAL "Flag to track whether this is the first time running CMake or if CMake has been configured before")
endif()
+
+# Installation.
+# First, install generated curlbuild.h
+install(FILES "${CMAKE_CURRENT_BINARY_DIR}/include/curl/curlbuild.h"
+ DESTINATION include/curl )
+# Next, install other headers excluding curlbuild.h
+install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/include/curl"
+ DESTINATION include
+ FILES_MATCHING PATTERN "*.h"
+ PATTERN "curlbuild.h" EXCLUDE)
+
\ No newline at end of file
CMake builds can be configured either from the command line, or from one
of CMake's GUI's.
+Important notice
+==================
+ If you got your curl sources from a distribution tarball, make sure to
+ delete the generic 'include/curl/curlbuild.h' file that comes with it:
+ rm -f curl/include/curl/curlbuild.h
+
+ The purpose of this file is to provide reasonable definitions for systems
+ where autoconfiguration is not available. CMake will create its own
+ version of this file in its build directory. If the "generic" version
+ is not deleted, weird build errors may occur on some systems.
+
Command Line CMake
==================
A command line build of Curl is similar to the autotools build of Curl. It
# variable prior to running CMake.
cmake ../curl
make
- # currently make test and make install are not implemented
+ # currently make test is not implemented
#make test
- #make install
+ # Install to default location:
+ make install
ccmake
=========