aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBill Hoffman <bill.hoffman@kitware.com>2009-06-06 13:18:01 +0000
committerBill Hoffman <bill.hoffman@kitware.com>2009-06-06 13:18:01 +0000
commit15be673054bd0b71f9a4e47ee0af337f3d917e09 (patch)
tree124fcbee52c01872a0b21042a80ad0eb8e9076da
parent16a56496708b38dcbc05e744536046081b815c34 (diff)
ENH: add some cmake docs and fix build with socklen_t
-rw-r--r--CMake/CheckTypeSize.c.in6
-rw-r--r--CMakeLists.txt10
-rwxr-xr-xdocs/INSTALL.cmake65
-rwxr-xr-xdocs/README.cmake16
-rw-r--r--include/curl/curlbuild.h.cmake23
5 files changed, 118 insertions, 2 deletions
diff --git a/CMake/CheckTypeSize.c.in b/CMake/CheckTypeSize.c.in
index 8c9a0163e..ba8d3044c 100644
--- a/CMake/CheckTypeSize.c.in
+++ b/CMake/CheckTypeSize.c.in
@@ -6,6 +6,12 @@
# include <sys/types.h>
#endif /* HAVE_SYS_TYPES_H */
+
+#ifdef _WIN32
+# include <ws2tcpip.h>
+#endif
+
+
#ifdef HAVE_STDINT_H
# include <stdint.h>
#endif /* HAVE_STDINT_H */
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1ffc32888..f21c1c64b 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,6 @@
# 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 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)
SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMake;${CMAKE_MODULE_PATH}")
INCLUDE(Utilities)
@@ -642,7 +641,6 @@ ENDFOREACH(CURL_TEST)
IF(HAVE_FILE_OFFSET_BITS)
SET(_FILE_OFFSET_BITS 64)
ENDIF(HAVE_FILE_OFFSET_BITS)
-
FOREACH(CURL_TEST
HAVE_GLIBC_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(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)
ADD_DEFINITIONS(-DHAVE_CONFIG_H)
diff --git a/docs/INSTALL.cmake b/docs/INSTALL.cmake
new file mode 100755
index 000000000..d9f1e7978
--- /dev/null
+++ b/docs/INSTALL.cmake
@@ -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.
+
diff --git a/docs/README.cmake b/docs/README.cmake
new file mode 100755
index 000000000..7129b79ac
--- /dev/null
+++ b/docs/README.cmake
@@ -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.
diff --git a/include/curl/curlbuild.h.cmake b/include/curl/curlbuild.h.cmake
index 07fcc1aeb..0173a215f 100644
--- a/include/curl/curlbuild.h.cmake
+++ b/include/curl/curlbuild.h.cmake
@@ -63,6 +63,15 @@
Error Compilation_aborted_CURL_SIZEOF_LONG_already_defined
#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
# error "CURL_TYPEOF_CURL_OFF_T shall not be defined except in curlbuild.h"
Error Compilation_aborted_CURL_TYPEOF_CURL_OFF_T_already_defined
@@ -126,6 +135,20 @@
/* The size of `long', as computed by sizeof. */
#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. */
#cmakedefine CURL_TYPEOF_CURL_OFF_T ${CURL_TYPEOF_CURL_OFF_T}