[CMake] Windows Registry keys and values
Pau Garcia i Quiles
pgquiles at elpauer.org
Fri Jun 1 09:42:16 EDT 2007
Quoting Bill Hoffman <bill.hoffman at kitware.com>:
> Pau Garcia i Quiles wrote:
>> Hello,
>>
>> Does CMake provide any command to check for the existence of keys
>> in the Windows registry, or to find out its values? I have been
>> searching but nothing came along. Is running "reg query
>> REGISTRY_PATH /v KEY" the only way?
>
> Some commands do. For example, the FIND_* stuff can use the registry
> for paths like this:
>
> [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root]/lib
>
> If you grep for HKEY in the Modules directory you can see many examples.
I knew but I am interested in the case you say below. I should have
been more specific in my question.
> In addition the GET_FILENAME_COMPONENT calls on the FileName.
> So, you might be able to do this:
>
> GET_FILENAME_COMPONENT(foo
> [HKEY_LOCAL_MACHINE\\SOFTWARE\\Scriptics\\Tcl\\8.4;Root])
>
> And foo would have the registry value.
>
> -Bill
That doesn't work for me. With this CMakeLists.txt file:
============
GET_FILENAME_COMPONENT( THE_PATH
[HKEY_LOCAL_MACHINE\\SOFTWARE\\Boost-Consulting.com\\1.34.0;InstallRoot]
)
MESSAGE( "THE_PATH = ${THE_PATH}" )
============
I receive this error:
============
C:\temp3\a>cmake ..
-- Check for working C compiler: cl
-- Check for working C compiler: cl -- works
-- Check size of void*
-- Check size of void* - done
-- Check for working CXX compiler: cl
-- Check for working CXX compiler: cl -- works
CMake Error: Error in cmake code at
C:/temp3/CMakeLists.txt:1:
GET_FILENAME_COMPONENT called with incorrect number of arguments
Current CMake stack: C:/temp3/CMakeLists.txt;C:/Archivos de
programa/CMake
2.4/share/cmake-2.4/Modules/CMakeCInformation.cmake;C:/Archivos de
programa/CMake
2.4/share/cmake-2.4/Modules/Platform/Windows-cl.cmake;C:/temp3/a/CMakeFiles/CMakeCP
latform.cmake
THE_PATH =
-- Configuring done
============
I am using CMake 2.4.6.
Thank you.
More information about the CMake
mailing list