[Cmake] Modules/FindPythonLibs.cmake : 8.4 + registry support

Sebastien BARRE sebastien at barre.nom.fr
Fri May 11 17:24:20 EDT 2001


At 11/05/2001 11:06, Ken Martin wrote:
>Hello Folk,
>
>I have added registry support to the FIND_LIBRARY, FIND_PATH and
>FIND_PROGRAM commands. See below ...

OK Ken, I've added the following stuff :

>The regexp is \[(HKEY[A-Za-z_0-9\.\\]*)\] so I'm basically looking for
>[HKEY I don't think there is any need for a special word.

Correct me if I'm wrong, but you forgot the space ' ' in your regexp. Added.
BTW, I don't know what is the exact character set of a key :)

I've added support for 8.4 (tcl84 tk84)

I've also added registry support. I had to modify cmSystemTools, for the 
following reason :

HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
is working OK because the data located in this key is in its "default" value.

This does not work for Tcl, because the "default" value of
HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4
has no data...
The data (the install path) is located in the "Root" value.

I've modified ReadAValue to support the following syntax :

// Get the data of key value.
// Example :
//      HKEY_LOCAL_MACHINE\SOFTWARE\Python\PythonCore\2.1\InstallPath
//      =>  will return the data of the "default" value of the key
//      HKEY_LOCAL_MACHINE\SOFTWARE\Scriptics\Tcl\8.4§Root
//      =>  will return the data of the "Root" value of the key

The specific value name is appended to the key name after the "§" char (I 
modified the regexp accordingly to accept this char). Every suggestion is 
welcome as a better separator : I tried ':', '|', '#', '$', sadly they 
could all be found in some (or many) key name. "§" was not found in any key 
name of my registry (which is big).

As a consequence of this observation, I've just modified the regexp to 
accept all chars, the previous char set was really to small, don't you 
think so ? :
   cmRegularExpression regEntry("\\[(HKEY.*)\\]");

I do not know how your regexp engine works, but if it tries to match as 
many chars as possible, this regexp will fail if *more* than one key is 
used in the same string (eg. [HKEY stuff]foo/bar[KHEY stuff2] will return 
only one match : [HKEY stuff]foo/bar[KHEY stuff2] instead of [HKEY stuff] 
then [HKEY stuff2] ). The usual regexp trick is to disable this "greedy 
mode" by using *? instead of *. I does not seem to be supported. Neither 
does the \\[(HKEY[^\\]]*)\\] look to be supported. Any clues ?

Hope this helps





More information about the CMake mailing list