[CMake] Read Windows Registry value

2009-02-09 Thread elizabeta petreska
HelloI am trying to read MatlabRoot from Registry ,so I can use it in my
include and lib paths.
like this :
GET_FILENAME_COMPONENT(MATLAB_ROOT_PATH
 [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT] ABSOLUTE)
message(${MATLAB_ROOT_PATH})

But the message only prints /registry.

Where is the mistake?
___
Powered by www.kitware.com

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

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

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

Re: [CMake] Read Windows Registry value

2009-02-09 Thread Eric Noulard
2009/2/9 elizabeta petreska elizabeta.petre...@gmail.com:
 Hello
 I am trying to read MatlabRoot from Registry ,so I can use it in my include
 and lib paths.
 like this :
 GET_FILENAME_COMPONENT(MATLAB_ROOT_PATH
  [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT] ABSOLUTE)
 message(${MATLAB_ROOT_PATH})

I don't think you need the GET_FILENAME_COMPONENT.
Would yuo try:

SET(MATLAB_ROOT_PATH
[HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT])
MESSAGE(MATLAB_ROOT_PATH = ${MATLAB_ROOT_PATH})


-- 
Erk
___
Powered by www.kitware.com

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

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

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


Re: [CMake] Read Windows Registry value

2009-02-09 Thread elizabeta petreska
Still not working.I am getting the following :
MATLAB_ROOT_PATH =
[HKEY_LOCAL_MACHINE\SOFTWARE\MathWorks\MATLAB\7.6;MATLABROOT]

On Mon, Feb 9, 2009 at 4:28 PM, Eric Noulard eric.noul...@gmail.com wrote:

 2009/2/9 elizabeta petreska elizabeta.petre...@gmail.com:
  Hello
  I am trying to read MatlabRoot from Registry ,so I can use it in my
 include
  and lib paths.
  like this :
  GET_FILENAME_COMPONENT(MATLAB_ROOT_PATH
   [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT]
 ABSOLUTE)
  message(${MATLAB_ROOT_PATH})

 I don't think you need the GET_FILENAME_COMPONENT.
 Would yuo try:

 SET(MATLAB_ROOT_PATH
 [HKEY_LOCAL_MACHINE\\SOFTWARE\\MathWorks\\MATLAB\\7.0;MATLABROOT])
 MESSAGE(MATLAB_ROOT_PATH = ${MATLAB_ROOT_PATH})


 --
 Erk

___
Powered by www.kitware.com

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

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

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

Re: [CMake] Read Windows Registry value

2009-02-09 Thread Eric Noulard
2009/2/9 elizabeta petreska elizabeta.petre...@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:\Testcmake -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\Testcmake -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


registry.cmake
Description: Binary data
___
Powered by www.kitware.com

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

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

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