mirror of
https://github.com/moparisthebest/curl
synced 2024-12-22 08:08:50 -05:00
ENH: add some cmake docs and fix build with socklen_t
This commit is contained in:
parent
16a5649670
commit
15be673054
@ -6,6 +6,12 @@
|
|||||||
# include <sys/types.h>
|
# include <sys/types.h>
|
||||||
#endif /* HAVE_SYS_TYPES_H */
|
#endif /* HAVE_SYS_TYPES_H */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
# include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_STDINT_H
|
#ifdef HAVE_STDINT_H
|
||||||
# include <stdint.h>
|
# include <stdint.h>
|
||||||
#endif /* HAVE_STDINT_H */
|
#endif /* HAVE_STDINT_H */
|
||||||
|
@ -17,7 +17,6 @@
|
|||||||
# To check:
|
# To check:
|
||||||
# (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not.
|
# (From Daniel Stenberg) The cmake build selected to run gcc with -fPIC on my box while the plain configure script did not.
|
||||||
# (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options.
|
# (From Daniel Stenberg) The gcc command line use neither -g nor any -O options. As a developer, I also treasure our configure scripts's --enable-debug option that sets a long range of "picky" compiler options.
|
||||||
|
|
||||||
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2 FATAL_ERROR)
|
CMAKE_MINIMUM_REQUIRED(VERSION 2.6.2 FATAL_ERROR)
|
||||||
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
|
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
|
||||||
INCLUDE(Utilities)
|
INCLUDE(Utilities)
|
||||||
@ -642,7 +641,6 @@ ENDFOREACH(CURL_TEST)
|
|||||||
IF(HAVE_FILE_OFFSET_BITS)
|
IF(HAVE_FILE_OFFSET_BITS)
|
||||||
SET(_FILE_OFFSET_BITS 64)
|
SET(_FILE_OFFSET_BITS 64)
|
||||||
ENDIF(HAVE_FILE_OFFSET_BITS)
|
ENDIF(HAVE_FILE_OFFSET_BITS)
|
||||||
|
|
||||||
FOREACH(CURL_TEST
|
FOREACH(CURL_TEST
|
||||||
HAVE_GLIBC_STRERROR_R
|
HAVE_GLIBC_STRERROR_R
|
||||||
HAVE_POSIX_STRERROR_R
|
HAVE_POSIX_STRERROR_R
|
||||||
@ -748,6 +746,14 @@ IF(CMAKE_COMPILER_IS_GNUCC AND APPLE)
|
|||||||
ENDIF(HAVE_C_FLAG_Wno_long_double)
|
ENDIF(HAVE_C_FLAG_Wno_long_double)
|
||||||
ENDIF(CMAKE_COMPILER_IS_GNUCC AND APPLE)
|
ENDIF(CMAKE_COMPILER_IS_GNUCC AND APPLE)
|
||||||
|
|
||||||
|
IF(HAVE_SOCKLEN_T)
|
||||||
|
SET(CURL_TYPEOF_CURL_SOCKLEN_T "socklen_t")
|
||||||
|
CHECK_TYPE_SIZE("socklen_t" CURL_SIZEOF_CURL_SOCKLEN_T)
|
||||||
|
ELSE()
|
||||||
|
SET(CURL_TYPEOF_CURL_SOCKLEN_T int)
|
||||||
|
SET(CURL_SIZEOF_CURL_SOCKLEN_T ${SIZEOF_INT})
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
INCLUDE(CMake/OtherTests.cmake)
|
INCLUDE(CMake/OtherTests.cmake)
|
||||||
|
|
||||||
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
|
||||||
|
65
docs/INSTALL.cmake
Executable file
65
docs/INSTALL.cmake
Executable file
@ -0,0 +1,65 @@
|
|||||||
|
_ _ ____ _
|
||||||
|
___| | | | _ \| |
|
||||||
|
/ __| | | | |_) | |
|
||||||
|
| (__| |_| | _ <| |___
|
||||||
|
\___|\___/|_| \_\_____|
|
||||||
|
|
||||||
|
How To Compile with CMake
|
||||||
|
|
||||||
|
Building with CMake
|
||||||
|
==========================
|
||||||
|
This document describes how to compile, build and install curl and libcurl
|
||||||
|
from source code using the CMake build tool. To build with CMake, you will
|
||||||
|
of course have to first install CMake. The minimum required version of
|
||||||
|
CMake is specifed in the file CMakeLists.txt found in the top of the curl
|
||||||
|
source tree. Once the correct version of CMake is installed you can follow
|
||||||
|
the instructions below for the platform you are building on.
|
||||||
|
|
||||||
|
CMake builds can be configured either from the command line, or from one
|
||||||
|
of CMake's GUI's.
|
||||||
|
|
||||||
|
Command Line CMake
|
||||||
|
==================
|
||||||
|
A command line build of Curl is similar to the autotools build of Curl. It
|
||||||
|
consists of the following steps after you have unpacked the source.
|
||||||
|
# 1st create an out of source build tree parallel to the curl source
|
||||||
|
# tree and change into that directory
|
||||||
|
mkdir curl-build
|
||||||
|
cd curl-build
|
||||||
|
# now run CMake from the build tree, giving it the path to the top of
|
||||||
|
# the Curl source tree. CMake will pick a compiler for you. If you
|
||||||
|
# want to specifiy the compile, you can set the CC environment
|
||||||
|
# variable prior to running CMake.
|
||||||
|
cmake ../curl
|
||||||
|
make
|
||||||
|
# currently make test and make install are not implemented
|
||||||
|
#make test
|
||||||
|
#make install
|
||||||
|
|
||||||
|
ccmake
|
||||||
|
=========
|
||||||
|
CMake comes with a curses based interface called ccmake. To run ccmake on
|
||||||
|
a curl use the instructions for the command line cmake, but substitue
|
||||||
|
ccmake ../curl for cmake ../curl. This will bring up a curses interface
|
||||||
|
with instructions on the bottom of the screen. You can press the "c" key
|
||||||
|
to configure the project, and the "g" key to generate the project. After
|
||||||
|
the project is generated, you can run make.
|
||||||
|
|
||||||
|
cmake-gui
|
||||||
|
=========
|
||||||
|
CMake also comes with a Qt based GUI called cmake-gui. To configure with
|
||||||
|
cmake-gui, you run cmake-gui and follow these steps:
|
||||||
|
1. Fill in the "Where is the source code" combo box with the path to
|
||||||
|
the curl source tree.
|
||||||
|
2. Fill in the "Where to build the binaries" combo box with the path
|
||||||
|
to the directory for your build tree, ideally this should not be the
|
||||||
|
same as the source tree, but a parallel diretory called curl-build or
|
||||||
|
something similar.
|
||||||
|
3. Once the source and binary directories are specified, press the
|
||||||
|
"Configure" button.
|
||||||
|
4. Select the native build tool that you want to use.
|
||||||
|
5. At this point you can change any of the options presented in the
|
||||||
|
GUI. Once you have selected all the options you want, click the
|
||||||
|
"Generate" button.
|
||||||
|
6. Run the native build tool that you used CMake to genratate.
|
||||||
|
|
16
docs/README.cmake
Executable file
16
docs/README.cmake
Executable file
@ -0,0 +1,16 @@
|
|||||||
|
_ _ ____ _
|
||||||
|
___| | | | _ \| |
|
||||||
|
/ __| | | | |_) | |
|
||||||
|
| (__| |_| | _ <| |___
|
||||||
|
\___|\___/|_| \_\_____|
|
||||||
|
|
||||||
|
README.cmake
|
||||||
|
Read the README file first.
|
||||||
|
|
||||||
|
Curl contains CMake build files that provide a way to build Curl with the
|
||||||
|
CMake build tool (www.cmake.org). CMake is a cross platform meta build tool
|
||||||
|
that generates native makefiles and IDE project files. The CMake build
|
||||||
|
system can be used to build Curl on any of its supported platforms.
|
||||||
|
|
||||||
|
Read the INSTALL.cmake file for instructions on how to compile curl with
|
||||||
|
CMake.
|
@ -63,6 +63,15 @@
|
|||||||
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
|
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef CURL_TYPEOF_CURL_SOCKLEN_T
|
||||||
|
# error "CURL_TYPEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||||
|
Error Compilation_aborted_CURL_TYPEOF_CURL_SOCKLEN_T_already_defined
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef CURL_SIZEOF_CURL_SOCKLEN_T
|
||||||
|
# error "CURL_SIZEOF_CURL_SOCKLEN_T shall not be defined except in curlbuild.h"
|
||||||
|
Error Compilation_aborted_CURL_SIZEOF_CURL_SOCKLEN_T_already_defined
|
||||||
|
#endif
|
||||||
#ifdef CURL_TYPEOF_CURL_OFF_T
|
#ifdef CURL_TYPEOF_CURL_OFF_T
|
||||||
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
|
||||||
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
|
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
|
||||||
@ -126,6 +135,20 @@
|
|||||||
/* The size of `long', as computed by sizeof. */
|
/* The size of `long', as computed by sizeof. */
|
||||||
#cmakedefine CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG}
|
#cmakedefine CURL_SIZEOF_LONG ${CURL_SIZEOF_LONG}
|
||||||
|
|
||||||
|
/* Integral data type used for curl_socklen_t. */
|
||||||
|
#cmakedefine CURL_TYPEOF_CURL_SOCKLEN_T ${CURL_TYPEOF_CURL_SOCKLEN_T}
|
||||||
|
|
||||||
|
/* on windows socklen_t is in here */
|
||||||
|
#ifdef _WIN32
|
||||||
|
# include <ws2tcpip.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Data type definition of curl_socklen_t. */
|
||||||
|
typedef CURL_TYPEOF_CURL_SOCKLEN_T curl_socklen_t;
|
||||||
|
|
||||||
|
/* The size of `curl_socklen_t', as computed by sizeof. */
|
||||||
|
#cmakedefine CURL_SIZEOF_CURL_SOCKLEN_T ${CURL_SIZEOF_CURL_SOCKLEN_T}
|
||||||
|
|
||||||
/* Signed integral data type used for curl_off_t. */
|
/* Signed integral data type used for curl_off_t. */
|
||||||
#cmakedefine CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T}
|
#cmakedefine CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user