CMake and ksysguardd

Alexander Neundorf neundorf at kde.org
Thu Oct 1 18:47:20 CEST 2009


On Wednesday 30 September 2009, Pau Garcia i Quiles wrote:
> On Wed, Sep 30, 2009 at 9:52 PM, Alexander Neundorf <neundorf at kde.org>
> wrote: [...]
>
> > ######### copy the contents of the three macros here:
> >
> > macro(MACRO_BOOL_TO_01 ...)
> > ...
> > endmacro(...)
> > ...
>
> [...]
>
> Thread-jacking but still: would it be possible to add stuff like
> MacroOptionalFindPackage, MacroBoolTo01, MacroLogFeature,
> MacroEnsureVersion, MacroEnsureOutOfSourceBuild, etc to CMake 2.8 ?
>
> For instance:


> * MacroEnsureOutOfSourceBuild -> PROJECT( myproj OUTOFSOURCE )

Please file a feature request in the cmake bug tracker.

> * MacroPushRequiredVars -> Add CMAKE_REQUIRED_XXX parameters to the
> macros that use them instead of defining CMAKE_REQUIRED_XXX globally,
> then this whole push/pop issue is gone. For instance, change the
> signature of CHECK_FUNCTION_EXISTS from CHECK_FUNCTION_EXISTS(FUNCTION
> VARIABLE) to
>                 CHECK_FUNCTION_EXISTS( function variable
>                                               [ CMAKE_REQUIRED_FLAGS crf ]
>                                               [ CMAKE_REQUIRED_DEFINITIONS
> crd ] [ CMAKE_REQUIRED_INCLUDES cri ] [ CMAKE_REQUIRED_LIBRARIES crl ] )

I think a patch which does this consistently for all related such macros 
shipping with cmake would probably be accepted (yes, I know this is some 
work).

> * MacroLogFeature -> MESSAGE( LOG VAR FEATURE DESCRIPTION URL
> [REQUIRED [MIN_VERSION [COMMENTS]]] ) (same parameters
> MACRO_LOG_FEATURE has)

This one is basically in cmake since 2.6.0. Have a look at 
FeatureSummary.cmake, coming with cmake. It's also on my list of TODOs to 
have a look how we can make use of that one in KDE.

> * MacroAppendIf -> LIST( APPEND_IF ... )
>
> * MacroBoolTo01 -> Just bundle it with CMake 2.8 and rename it to
> BOOL_TO_01. I would have loved something like SET( 01 VAR RESULT0 ...
> RESULTN ) but I guess it's a major change in SET behavior

I doubt that for both. 
An idea I had was that CMake might come with a CMakeMacros.cmake file, which 
is read by default, which provides additional macros, so they are available 
out-of-the-box, similar to builtin commands. These two would fit that 
category I think. 
But this idea didn't have a lot of success among the other CMake developers.

> * MacroOptionalAddSubdirectory -> ADD_SUBDIRECTORY ( dir OPTIONAL )
>
> * MacroOptionalFindPackage -> FIND_PACKAGE( blah OPTIONAL )

Not sure. There is not other builtin cmake command which is coupled with an 
option.  

Alex


More information about the Kde-buildsystem mailing list