[CMake] How to list user-definable CMake variables

Michael Wild themiwi at gmail.com
Tue Sep 28 05:10:53 EDT 2010


On 28. Sep, 2010, at 11:03 , Marcel Loose wrote:

> On Tue, 2010-09-28 at 10:43 +0200, Michael Wild wrote:
>> On 28. Sep, 2010, at 10:12 , Marcel Loose wrote:
>> 
>>> 
>>> On 28. Sep, 2010, at 9:33 , Marcel Loose wrote:
>>> 
>>>>> Hi all,
>>>>> 
>>>>> I was wondering how I could generate a list of user-definable
> CMake
>>>>> variables. This list, with a brief help per variable, would be
>>> *very*
>>>>> useful for the end-user. It's a bit like the well-known "configure
>>>>> --help" which gives you a overview of all variables that can be
> set.
>>>>> 
>>>>> Best regards,
>>>>> Marcel Loose.
>>>> 
>>>> Is "cmake -LAH" what you want?
>>>> 
>>>> Michael
>>> 
>>> Hi Michael,
>>> 
>>> Well this is sort of what I was looking for, though I was hoping
> that it
>>> would be possible to list any useful variable *before* running
> CMake.
>>> 
>>> Is there some kind of hook, e.g. 'cmake --custom-help', that can be
> used
>>> to display project-specific help. The help text should be provided
> by
>>> the developer, of course.
>>> 
>>> Best regards,
>>> Marcel Loose.
>> 
>> Not that I'd know of. I also think that this would be quite difficult
> to implement. You're far better off writing an extensive README or
> INSTALL document.
>> 
>> Michael
>> 
>> --
>> There is always a well-known solution to every human problem -- neat,
> plausible, and wrong.
>> H. L. Mencken
>> 
> That's a pity.
> 
> Of course there's nothing against having a good, useful README and/or
> INSTALL file. But I also like to keep the documentation close to the
> code. The more documentation and code get separated, the higher the risk
> that the two diverge.
> 
> Anyway, thanks for thinking with me.
> 
> Best regards,
> Marcel Loose.
> 


Of course, it would be ideal if CMake had a way of spewing out all the documentation strings of all the cache variables, but IMHO this is nigh impossible, e.g. what do you do with conditionally set cache variables? If you treat them as being unconditional, you might accidentally offer too many options which don't have any effect (perhaps it's a conditional on WIN32 or similar), or you might have conflicts (e.g. different doc strings and default values for WIN32 and UNIX).

Michael

--
There is always a well-known solution to every human problem -- neat, plausible, and wrong.
H. L. Mencken

-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 195 bytes
Desc: This is a digitally signed message part
URL: <http://www.cmake.org/pipermail/cmake/attachments/20100928/fa598ad8/attachment-0001.pgp>


More information about the CMake mailing list