[cmake-developers] Fwd: Adding macro cmake_print_variables(var1 var2 ... varN) ?
Eric Noulard
eric.noulard at gmail.com
Sun Dec 11 13:18:33 EST 2011
List was dropped intentionally
---------- Forwarded message ----------
From: Eric Noulard <eric.noulard at gmail.com>
Date: 2011/12/11
Subject: Re: [cmake-developers] Adding macro
cmake_print_variables(var1 var2 ... varN) ?
To: neundorf at kde.org
2011/12/11 Alexander Neundorf <neundorf at kde.org>:
> 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=""
pretty handy.
> Ok to add to git ?
May be in a specific separate file like
CMakeScriptsDebuggingTools.cmake
(or some less lengthy name)
one may include ?
> Or should this better be
> message(VARIABLES CMAKE_C_COMPILER
> CMAKE_MAJOR_VERSION
> THIS_ONE_DOES_NOT_EXIST)
Nope I wouldn't vote for that one.
How would you print
message(VARIABLES "BLAH " CMAKE_C_COMPILER)
and
message(VARIABLES "BLAH CMAKE_C_COMPILER")
what you be nice as a built-in is something like
trace_var(CMAKE_C_COMPILER)
which would make the concerned VAR to be traced each time
it is touched (read or written) by a script.
That said we are far away from your initial need.
and... I'm not volunteering to develop that :-(
> 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.
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
--
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org
More information about the cmake-developers
mailing list