[CMake] What's wrong with this regexp?

Pau Garcia i Quiles pgquiles at elpauer.org
Fri Jun 1 06:11:30 EDT 2007


Hello,

I am running this code in my CMakeLists.txt:

SET( KEY "HKLM\\Software\\Boost-Consulting.com\\1.34.0" )
SET( SUBKEY "InstallRoot" )
EXECUTE_PROCESS( COMMAND reg.exe QUERY ${KEY} /v ${SUBKEY}  
RESULT_VARIABLE RET_VAL OUTPUT_VARIABLE REG_OUTPUT )
STRING( REGEX REPLACE "! REG.EXE VERSION  
[0-9.0-9].*${SUBKEY}.+[REG_SZ|REG_BINARY|REG_DWORD|REG_MULTI_SZ|REG_EXPAND_SZ]  
*(.*boost.*)" \\1 THE_DAMN_PATH ${REG_OUTPUT} )
MESSAGE("THE_DAMN_PATH = ${THE_DAMN_PATH}" )

The output of "REG QUERY HKLM\Software\Boost-Consulting.com\1.34.0 /v  
InstallRoot" when ran from cmd.exe is:

C:\temp2\test>REG QUERY HKLM\Software\Boost-consulting.com\1.34.0 /v  
InstallRoot


! REG.EXE VERSION 3.0

HKEY_LOCAL_MACHINE\Software\Boost-consulting.com\1.34.0
     InstallRoot REG_SZ  C:\Archivos de programa\boost\boost_1_34_0

Therefore I should be getting:

C:\Archivos de programa\boost\boost_1_34_0

But I get:

rchivos de programa\boost\boost_1_34_0

What is wrong with my regexp?

Thank you.

-- 
Pau Garcia i Quiles
http://www.elpauer.org
(Due to the amount of work, I usually need 10 days to answer)







More information about the CMake mailing list