[CMake] How to list user-definable CMake variables

Eric Noulard eric.noulard at gmail.com
Tue Sep 28 05:11:36 EDT 2010


2010/9/28 Marcel Loose <loose at astron.nl>:
>>
>> You may want to call your target "help" but it would conflict/override
>> the cmake builtin "help" target
>> (at least for makefile generator) which display the list of available
> target.
>>
>> This work AFTER cmake has been run. It could be run before as well
> using:
>>
>> cmake -DCMAKE_MODULE_PATH=/path/to/source --help-module HelpMe
>>
>> but this is awkward :-(
>>
> Thanks Erk,
>
> I'll give it a thought. Your solution uses some nice CMake features, but
> I find it a bit awkward. It suffers from separation of code and
> documentation, though. That's always risky, since the two are likely to
> diverge.

It is a little bit, but you can put in this "custom cmake file"
(you may rename it to "CustomizableOptions.cmake")
any CMake *code* you want including the definition of OPTION or vars
(using SET) etc...

then in you CMakeLists.txt you can

include(CustomizableOptions.cmake)

and the "header" of the file contains the useful doc. for the
concerned option/vars.

then the code and it's doc stay together.




-- 
Erk
Membre de l'April - « promouvoir et défendre le logiciel libre » -
http://www.april.org


More information about the CMake mailing list