[CMake] Including unquoted ENV ProgramFiles in PATHS makes find_* fail

Walter Gray chrysalisx at gmail.com
Fri Oct 31 16:59:06 EDT 2014


I was working on a find module, and ran into some rather unpredicted 
behavior - it appears that including ENV ProgramFiles at the end the 
list of PATHS makes the search fail!  Remove that line, put it first, or 
put it in quotes, and it works just fine.  Does anyone have any clue why 
this might happen? For reference, here's the command and the value of 
ProgramFiles on my machine:

ProgramFiles=C:\Program Files (x86)

#Fails:
find_path(wxWidgets_ROOT_DIR
     NAMES include/wx/wx.h
     PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno 
Setup: App Path]"
       ENV ProgramFiles
     )
#Works:
find_path(wxWidgets_ROOT_DIR
     NAMES include/wx/wx.h
     PATHS
       ENV ProgramFiles
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno 
Setup: App Path]"
     )
#Works
find_path(wxWidgets_ROOT_DIR
     NAMES include/wx/wx.h
     PATHS
"[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\wxWidgets_is1;Inno 
Setup: App Path]"
       "ENV ProgramFiles"
     )



More information about the CMake mailing list