[CMake] build.h instead of config.h

Eric Noulard eric.noulard at gmail.com
Tue Jan 18 13:14:42 EST 2011


2011/1/18 luxInteg <lux-integ at btconnect.com>:
> On Tuesday 18 January 2011 08:23:49 Eric Noulard wrote:
>
>> May be you can post your CMakeLists.txt here if it's not too big?
>> What is your platform/compiler target?
>> Linux/gcc, Windows/Visual etc...
>> I bet the " -MT  -MD -MP" options are specific to the compiler use, did you
>
>
> Thanks for your kind response.
>
>
> Rhe  package in question is gsl
> ( http://www.gnu.org/software/gsl/ )
> and the platform is linux; compiler gcc
>
> I have generated a config.h   of sorts  ( I was looking at the wrong source
> directory.  build.h is  there alright as  an integral part thereof).
> CMake did generate Makefiles and  a config.h.  The make fails not long after
> starting  with  the following:-


Ok.
You have (at least) two kinds of issue here

1) Some CheckFunctionExists tests needs the math library
   so that you need to
    set(CMAKE_REQUIRED_LIBRARIES m)
   before calling
     CHECK_FUNCTION_EXISTS(asinh HAVE_ASINH)

2) Some autoconf tests cannot be directly translated to
     neither
       CHECK_INCLUDE_FILE
     nor
       CHECK_FUNCTION_EXISTS

    this is the case for " checking for IEEE comparisons"
    you'll need to read the gsl/configure.ac  file and make the
translation yourself.

>
> ###########
> ~/sys/infnan.c:98:3: error: #error "cannot define gsl_finite without
> HAVE_DECL_FINITE or HAVE_IEEE_COMPARISONS"
> ~/sys/infnan.c:115:3: error: #error "cannot define gsl_isnan without
> HAVE_DECL_ISNAN or HAVE_IEEE_COMPARISONS"
> ##########
>
> The problem seems to revolve around    the scope/ of the functions used  to
> mimic   the config.h (aoto-tools).
> :-
>

[...]


> ########### here is my config.h.cmake ##############
>
> INCLUDE (${CMAKE_ROOT}/Modules/CheckIncludeFile.cmake)

You don't need the ${CMAKE_ROOT}/Modules/ prefix you'd better simply

INCLUDE(CheckIncludeFile.cmake)

[...]

> -----------------
> To a cmake ignoramus like me, it would appear that more   is needed   to do
> ----maths/capability checks
> ----cpu checks
>
> for this type of package.

You are right but the fact is autotools does not have builtin function
for that either.
They are crafted inside gsl/configure.ac.

You'll need to do something equivalent with CMake.

> Advice would be appreciated.

Why are you willing to build gsl with CMake in the first place?
If you are willing to translate autotools based project into
CMake based oned you'll need to learn both autoconf and CMake...
for example the configure.ac from gsl is 350+ lines long
with some part not "trivially" translatable to CMake.



-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list