views:

29

answers:

1

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. I think cmake support for registry paths that contain ";" are broken on Windows 7. Can somebody confirm this? Is there any work-around?

+1  A: 

According to the wiki, you can't use SET to view the value of a registry key. The registry value is only read when you do some cache operation on it. For example, the following should output the path you want:

GET_FILENAME_COMPONENT(MYPATH "[HKEY_LOCAL_MACHINE\\SOFTWARE\\7-Zip;Path]"
                       ABSOLUTE CACHE)
MESSAGE("MYPATH = ${MYPATH}")
rq