Hi Petr,

On Wed, Oct 9, 2019, 09:57 Petr Kmoch <petr.km...@gmail.com> wrote:

> Hi Ellon.
>
> On Wed, 9 Oct 2019 at 09:51, Ellon Paiva <ellonpa...@gmail.com> wrote:
>
>> Hi there,
>>
>> I was wondering if there was a way to recover the help text passed to an
>> option to be used later below in the same CMake script.
>>
>> I saw that the help text goes into a comment before the option on the
>> CMakeCache.txt, but is it stored in any recoverable variable during the
>> script processing ?
>>
>>
> Since option() just creates a cache variable, you should be able to
> retrieve that variable's HELPSTRING property (
> https://cmake.org/cmake/help/latest/prop_cache/HELPSTRING.html ):
>
>   option(SampleOpt "Help")
>   get_property(result CACHE SampleOpt PROPERTY HELPSTRING)
>

Awesome, thanks!

Another somehow related question: is there a way to recover the name of all
options defined in a project?

Ellon



> Petr
>
-- 

Powered by www.kitware.com

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Kitware offers various services to support the CMake community. For more 
information on each offering, please visit:

CMake Support: http://cmake.org/cmake/help/support.html
CMake Consulting: http://cmake.org/cmake/help/consulting.html
CMake Training Courses: http://cmake.org/cmake/help/training.html

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Follow this link to subscribe/unsubscribe:
https://cmake.org/mailman/listinfo/cmake

Reply via email to