curl-library
Re: Build using CMake
Date: Mon, 23 Mar 2009 18:18:55 +0300
* Daniel Stenberg <daniel_at_haxx.se> [Fri, 20 Mar 2009 16:11:51 +0100
(CET)]:
> > I suggest creating CMake scripts to build cURL/libcurl. This is
> motivated by
> > the fact that I find libcurl very difficult to build under Windows
> (using
> > MSVC 8). Is there anyone interested in using this kind of build
> system? Is
> > there anyone interested in creating it?
>
> It has been mentioned (several times) in the past, but afaik there
have
> never
> been anyone bold enough to proceed and actually do it. Kind of ironic
> since
> the cmake project itself uses libcurl... :-)
Actually, I have been using CMake for building libcurl for some time. I
took the cmake templates and sources from CMake distribution, and fixed
them for newer versions of libcurl.
The good thing is, I must admit CMake is quite convenient - I can build
the same project under several different OSes (Win32, Linux 32 and
64bit, OpenSolaris x86) using almost identical commands. I have crafted
a perl script to migrate to newer versions of libcurl; this script does
most of the mundane checks and string substitutions.
As for the drawbacks: the main one is the immaturity of the build
system. I only build static libcurl library; I do not build any
executables. Consequently, there is no such build target as "make test"
for libcurl.
Besides, due to the nature of the build system, it is not possible to
use cross-compiler.
I have attached the script along with the files it needs. Some comments:
- works only on linux (may work on any unix variant, but I was too lazy
to test).
- to use: unpack; adjust the path to the curl build tree (it's at the
top of the script); run.
After the script is finished, the curl build tree will have
CMakeLists.txt and other files needed for CMake.
Here is an example (let's assume curl is in 'curl-7.19.4'):
# Prepare libcurl for building with CMake
$ cd curl_cmakify
$ ./cmakify.pl
... blablabla ...
# Now build libcurl
$ cd ..
$ mkdir curl_build
$ cd curl_build
$ cmake ../curl-7.19.4
... blablabla ...
$ make
... the library gets built ...
-- tetetest tetetest.
- application/x-gtar attachment: curl_cmakify.tgz