[cmake-developers] module merge mania

Alexander Neundorf neundorf at kde.org
Sat Sep 16 17:57:31 EDT 2006


Hi,

I'd like to add the following cmake modules we have in KDE svn to CMake cvs:

http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckCXXCompilerFlag.cmake?view=auto
CHECK_CXX_COMPILER_FLAG(FLAG VARIABLE) 
- Check whether the compiler supports a given flag.

(if you want to I add a C compiler version too)

http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckPointerMember.cmake?view=auto
CHECK_POINTER_MEMBER (POINTER MEMBER HEADER VARIABLE)
- Check if the given struct or class has the specified member variable

http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckStructMember.cmake?view=auto
CHECK_STRUCT_MEMBER (STRUCT MEMBER HEADER VARIABLE)
- Check if the given struct or class has the specified member variable

http://websvn.kde.org/trunk/KDE/kdelibs/cmake/modules/CheckPrototypeExists.cmake?view=auto
CHECK_PROTOTYPE_EXISTS (FUNCTION HEADER VARIABLE)
- Check if the prototype for a function exists.

And the following Find*.cmake modules:

FindBZip2.cmake
FindGIF.cmake
FindJasper.cmake
FindLibXml2.cmake
FindLibXslt.cmake
FindOpenSSL.cmake
FindASPELL.cmake
FindHSPELL.cmake

They all follow this scheme:

IF (GIF_INCLUDE_DIR AND GIF_LIBRARIES)
   # Already in cache, be silent
   SET(GIF_FIND_QUIETLY TRUE)
ENDIF (GIF_INCLUDE_DIR AND GIF_LIBRARIES)

FIND_PATH(GIF_INCLUDE_DIR gif_lib.h
  /usr/include
  /usr/local/include
)

set(POTENTIAL_GIF_LIBS gif libgif ungif libungif giflib)
FIND_LIBRARY(GIF_LIBRARIES NAMES ${POTENTIAL_GIF_LIBS}
  PATHS
  /usr/lib
  /usr/local/lib
)

if (GIF_INCLUDE_DIR AND GIF_LIBRARIES)
   set(CMAKE_REQUIRED_INCLUDES "${GIF_INCLUDE_DIR}" 
"${CMAKE_REQUIRED_INCLUDES}")
   CHECK_STRUCT_MEMBER(GifFileType UserData gif_lib.h GIF_FOUND)
endif (GIF_INCLUDE_DIR AND GIF_LIBRARIES)

if (GIF_FOUND)
  if (NOT GIF_FIND_QUIETLY)
    message(STATUS "Found GIF: ${GIF_LIBRARIES}")
  endif (NOT GIF_FIND_QUIETLY)
else (GIF_FOUND)
  if (GIF_FIND_REQUIRED)
    message(STATUS "Looked for GIF libraries named ${POTENTIAL_GIF_LIBS}.")
    message(STATUS "Found no acceptable GIF library. This is fatal.")
    message(FATAL_ERROR "Could NOT find GIF")
  endif (GIF_FIND_REQUIRED)
endif (GIF_FOUND)

MARK_AS_ADVANCED(GIF_INCLUDE_DIR GIF_LIBRARIES)



Ok to commit ?
Especially note the part at the beginning where QUIETLY is set explicitely if 
it has already been found before.

Bye
Alex
-- 
Work: alexander.neundorf AT jenoptik.com - http://www.jenoptik-los.de
Home: neundorf AT kde.org                - http://www.kde.org
      alex AT neundorf.net               - http://www.neundorf.net


More information about the cmake-developers mailing list