[cmake-developers] Adding macro cmake_print_variables(var1 var2 ... varN) ?
Alexander Neundorf
neundorf at kde.org
Tue Dec 13 15:34:06 EST 2011
On Sunday 11 December 2011, Alexander Neundorf wrote:
> Hi,
>
> I have a small macro/function which I need often during buildsystem
> debugging:
>
> function(PRINT_VARIABLES)
> set(msg "")
> foreach(var ${ARGN})
> if(msg)
> set(msg "${msg} ; ")
> endif()
> set(msg "${msg}${var}=\"${${var}}\"")
> endforeach()
> message(STATUS "${msg}")
> endfunction()
>
>
> it prints the values of the variables given as arguments.
> Example:
>
> print_variables(CMAKE_C_COMPILER
> CMAKE_MAJOR_VERSION
> THIS_ONE_DOES_NOT_EXIST)
>
> Gives:
> -- CMAKE_C_COMPILER="/usr/bin/gcc" ; CMAKE_MAJOR_VERSION="2" ;
> THIS_ONE_DOES_NOT_EXIST=""
>
>
> Ok to add to git ?
> Or should this better be
> message(VARIABLES CMAKE_C_COMPILER
> CMAKE_MAJOR_VERSION
> THIS_ONE_DOES_NOT_EXIST)
>
> Or not at all ?
> Then I'll put it in extra-cmake-modules, but it seems to generic that I
> think it makes sense to have it in cmake directly.
So, ok to add ?
Or should I wait until after 2.8.7 ?
Alex
More information about the cmake-developers
mailing list