diff options
author | Brad King <brad.king@kitware.com> | 2009-09-30 17:45:24 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2009-09-30 17:45:24 (GMT) |
commit | c63e3bd13ca61778e78c5f715a44998fb30adb80 (patch) | |
tree | 5642c02131eb1bbb0644102b6513f0967f90ff65 /Source/cmGetFilenameComponentCommand.cxx | |
parent | 56d1a1780d45d8f9f852e32162153d80721b4662 (diff) | |
download | CMake-c63e3bd13ca61778e78c5f715a44998fb30adb80.zip CMake-c63e3bd13ca61778e78c5f715a44998fb30adb80.tar.gz CMake-c63e3bd13ca61778e78c5f715a44998fb30adb80.tar.bz2 |
Fix get_filename_component() registry view
Some find-modules use get_filename_component() to expand registry
values. We need to look in both the 32-bit and 64-bit registry views
when expanding values. We prefer the one that the target application
would see. See issue #8792.
Diffstat (limited to 'Source/cmGetFilenameComponentCommand.cxx')
-rw-r--r-- | Source/cmGetFilenameComponentCommand.cxx | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/Source/cmGetFilenameComponentCommand.cxx b/Source/cmGetFilenameComponentCommand.cxx index 8d337e4..31b8336 100644 --- a/Source/cmGetFilenameComponentCommand.cxx +++ b/Source/cmGetFilenameComponentCommand.cxx @@ -35,7 +35,27 @@ bool cmGetFilenameComponentCommand std::string result; std::string filename = args[1]; - cmSystemTools::ExpandRegistryValues(filename); + if(filename.find("[HKEY") != filename.npos) + { + // Check the registry as the target application would view it. + cmSystemTools::KeyWOW64 view = cmSystemTools::KeyWOW64_32; + cmSystemTools::KeyWOW64 other_view = cmSystemTools::KeyWOW64_64; + if(this->Makefile->PlatformIs64Bit()) + { + view = cmSystemTools::KeyWOW64_64; + other_view = cmSystemTools::KeyWOW64_32; + } + cmSystemTools::ExpandRegistryValues(filename, view); + if(filename.find("/registry") != filename.npos) + { + std::string other = args[1]; + cmSystemTools::ExpandRegistryValues(other, other_view); + if(other.find("/registry") == other.npos) + { + filename = other; + } + } + } std::string storeArgs; std::string programArgs; if (args[2] == "PATH") |