[CMake] Windows Registry keys and values

Bill Hoffman bill.hoffman at kitware.com
Fri Jun 1 08:20:37 EDT 2007


Pau Garcia i Quiles wrote:
> Hello,
>
> Does CMake provide any command to check for the existence of keys in 
> the Windows registry, or to find out its values? I have been searching 
> but nothing came along. Is running "reg query REGISTRY_PATH /v KEY" 
> the only way?

Some commands do.  

For example, the FIND_* stuff can use the registry for paths like this:

  [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib

If you grep for HKEY in the Modules directory you can see many examples.
In addition the GET_FILENAME_COMPONENT calls on the FileName.
So, you might be able to do this:

GET_FILENAME_COMPONENT(foo 
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root])

And foo would have the registry value.

-Bill



More information about the CMake mailing list