[Dune-devel] cmake: set(HAVE_* *_FOUND) or set(HAVE_* ${*_FOUND})?

Markus Blatt markus at dr-blatt.de
Fri Dec 20 12:21:05 CET 2013


On Fri, Dec 20, 2013 at 11:48:31AM +0100, Ansgar Burchardt wrote:
> another problem I have with cmake is that sometimes
> 
>   set(HAVE_* *_FOUND)
> 
> is used instead of
> 
>   set(HAVE_* ${*_FOUND})
> 
> which causes config.h to contain -- for example --
> 
>   #define HAVE_PSURFACE PSURFACE_FOUND
> 
> which works if #ifdef HAVE_* is used, but not in places where #if HAVE_*
> is used.
> 
> Should the following five occurences be changed to ${*_FOUND} or did I
> miss something?
> 
> ./dune-common/cmake/modules/FindUMFPack.cmake:set(HAVE_UMFPACK
> UMFPACK_FOUND)
> ./dune-common/cmake/modules/DuneMPI.cmake:  set(HAVE_MPI MPI_CXX_FOUND)
> ./dune-grid/cmake/modules/FindPsurface.cmake:set(HAVE_PSURFACE
> PSURFACE_FOUND)
> ./dune-pdelab/cmake/modules/UsePETSc.cmake:set(HAVE_PETSC PETSC_FOUND)
> ./dune-istl/cmake/modules/FindSuperLU.cmake:set(HAVE_SUPERLU SUPERLU_FOUND)

They probably should for clarity. But it also should work like this,
shouldn't it? 
All the tests except for psurface use the enable trick (#define HAVE_*
ENABLE*) and just care that the HAVE_* is set to something that
evaluates to True. 

HAVE_PURSFACE should be either set or unset (same with
automake). Therefore using #if instead of #ifdef seems buggy to
me. But maybe I am missing something. Unfortunately, #if seems to be
used throughout dune-grid. I am actually wondering why this does not
cause any troubles. Maybe it is only include in programs that are built
if psurface is actually available?

Markus
-- 
Do you need more support with DUNE or HPC in general? 

Dr. Markus Blatt - HPC-Simulation-Software & Services http://www.dr-blatt.de
Hans-Bunte-Str. 8-10, 69123 Heidelberg, Germany
Tel.: +49 (0) 160 97590858  Fax: +49 (0)322 1108991658 




More information about the Dune-devel mailing list