[CMake] Reading registry broken on Windows 7?

Bill Hoffman bill.hoffman at kitware.com
Thu Nov 19 09:34:13 EST 2009


Celil Rufat wrote:
> On a Windows 7 machine I cannot read any registry values that contain a 
> semicolon.
> 
> For example if you have 7-zip, running the following
> 
> SET(MYPATH  [HKEY_LOCAL_MACHINE\\SOFTWARE\\7-Zip;Path])
> MESSAGE("MYPATH = ${MYPATH}")
> 
> results in
> 
> MYPATH = [HKEY_LOCAL_MACHINE\SOFTWARE\7-Zip;Path]
> 
> instead of the actual path as per the following thread
> 
> http://www.mail-archive.com/cmake@cmake.org/msg19014.html
> 
> I think registry paths that contain ";" are broken on Windows 7. Can 
> somebody confirm this? Is there any work-around?
> 
You want:

  get_filename_component(MYPATH 
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\7-Zip;Path]" PATH)

The message command does not look up registry values.

-Bill



More information about the CMake mailing list