cURL / Mailing Lists / curl-library / Single Mail

curl-library

Re: cmake

From: Daniel Stenberg <daniel_at_haxx.se>
Date: Wed, 15 Apr 2009 15:06:35 +0200 (CEST)

On Wed, 15 Apr 2009, Tetetest wrote:

> DS> 2. What's the purpose of CMake/Platforms/config-aix.h ?
>
> This is a legacy file that goes with CMake itself. I didn't check if it is
> really needed.

So we remove that and see if things go boom?

> DS> 3. I still can't build curl with cmake on Linux:
>
> DS> [ 29%] Building C object src/CMakeFiles/curl.dir/main.c.o
> DS> In file included from /home/daniel/src/curl-alt/lib/setup.h:40,
> DS> from /home/daniel/src/curl-alt/lib/strtoofft.h:26,
> DS> from /home/daniel/src/curl-alt/lib/curlx.h:41,
> DS> from /home/daniel/src/curl-alt/src/main.c:100:
> DS> /home/daniel/src/curl-alt/lib/config.h:375:1: warning: "HAVE_LIBZ" redefined
>
> Basically, CMake builds must use generated config.h file.

But why does it use leftovers from before? That seems like a bug!

> Looks like you are building in-source, and the build takes wrong
> config.h file. Try this:
>
> mkdir curl_build
> cd curl_build
> cmake ../path-to-curl
> make
> This should build curl out-of-source (which is the normal build mode for
> CMake).

Clearly something is missing as that doesn't work for me:

$ cmake --version
cmake version 2.6-patch 3
$ mkdir curl-cmake
$ cd curl-cmake
$ cmake ../curl-alt/
-- Configuring done
-- Generating done
-- Build files have been written to: /home/daniel/src/curl-alt
$ make
make: *** No targets specified and no makefile found. Stop.

> DS> Linking C executable curl
> DS> CMakeFiles/curl.dir/curlutil.c.o: In function `cutil_tvnow':
> DS> curlutil.c:(.text+0x15): undefined reference to `clock_gettime'
> DS> collect2: ld returned 1 exit status
>
> Again, it looks like your build catches the wrong config.h :)

Not exactly, that's the link phase that fails so a header file won't be used.
It is a lack of use/detect of the correct lib, librt in this case. But they
certainly seem related:

Interestingly, if I remove src/config.h and lib/config.h before I run "cmake .
&& make" it seems to work!?

BTW: how do I provide additional config options when I build with cmake? Like
"disable shared libs" and "enable debug mode" ?

-- 
  / daniel.haxx.se
Received on 2009-04-15