[CMake] Read Windows Registry value

Eric Noulard eric.noulard at gmail.com
Mon Feb 9 11:42:38 EST 2009


2009/2/9 elizabeta petreska <elizabeta.petreska at gmail.com>:
> Still not working.
> I am getting the following :
> MATLAB_ROOT_PATH =
> [HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB\7.6;MATLABROOT]

My first suggestion was silly.
Message may print this but registry read may be OK.

You'll find attached an example of registry usage which works here
(CMake 2.6.0 on Windows XP):

cmake -P registry.cmake
gives the following output:

D:\Test>cmake -P registry.cmake
SEVENZIP_PATH = [HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip;Path]
SEVENZIP_ROOT = C:/Program Files/7-Zip
HELPFILE = C:/Program Files/7-Zip

as you can see the registry is read by FIND_PATH and GET_FILENAME_COMPONENT
but a simple "message" does not evaluate the registry value.

When I try with your MATLAB registry entry I get:

D\Test>cmake -P registry.cmake
MYPATH = [HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB\7.6;MATLABROOT]
MYROOT = /registry
HELPFILE = HELPFILE-NOTFOUND

Which seems to be the behaviour you observe.
In my case this is logical since I have no matlab installed on my machine.
-- 
Erk
-------------- next part --------------
A non-text attachment was scrubbed...
Name: registry.cmake
Type: application/octet-stream
Size: 467 bytes
Desc: not available
URL: <http://www.cmake.org/pipermail/cmake/attachments/20090209/558521b4/attachment-0001.obj>


More information about the CMake mailing list