[CMake] CMake uses wrong value of ProgramFiles variable on Windows platforms
David Cole
david.cole at kitware.com
Mon Nov 10 17:28:30 EST 2008
You have discovered the magic of Windows. Again.
CMake is a 32-bit process. When Windows launches a 32-bit process on a Win64
machine, it gives the 32-bit process "C:\ProgramFiles (x86)" as the value of
the env var "ProgramFiles". But you are testing it from a 64-bit program,
the default cmd.exe on Win64.
You can also test if from the 32-bit cmd.exe, which is available at
C:\WINDOWS\SysWow64\cmd.exe:
(default 64-bit cmd.exe results)
C:\>set ProgramFiles
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
(explicit 32-bit cmd.exe results -- same as what cmake gets as a 32-bit app)
C:\>C:\WINDOWS\SysWow64\cmd.exe
Microsoft Windows [Version 5.2.3790]
(C) Copyright 1985-2003 Microsoft Corp.
C:\>set ProgramFiles
ProgramFiles=C:\Program Files (x86)
ProgramFiles(x86)=C:\Program Files (x86)
C:\>exit
C:\>
So..... cmake is not wrong. Windows is not wrong. It just is what it is.
ProgramFiles is a "special" env var. Adapt accordingly, I guess, is the best
advice I have for you... :-)
HTH,
David
On Mon, Nov 10, 2008 at 5:04 PM, Eric (Brad) Lemings <brad at rebit.com> wrote:
> Consider the following:
>
> C:\Users\myself\Test>type CMakeLists.txt
> cmake_minimum_required(VERSION 2.6)
> project (Test)
> message (STATUS ENV{ProgramFiles}=$ENV{ProgramFiles})
>
> C:\Users\myself\Test>set ProgramFiles
> ProgramFiles=C:\Program Files
> ProgramFiles(x86)=C:\Program Files (x86)
>
> C:\Users\myself\Test>cmake -G "NMake Makefiles"
> -- ENV{ProgramFiles}=C:\Program Files (x86)
> -- Configuring done
> -- Generating done
> -- Build files have been written to:
> C:/Users/elemings/Developer/Test/CMake/test05
>
> A.) Why is CMake intentionally using the wrong value for ProgramFiles,
> and B.) should this be corrected?
>
> Thanks,
> Eric.
> _______________________________________________
> CMake mailing list
> CMake at cmake.org
> http://www.cmake.org/mailman/listinfo/cmake
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20081110/c02da943/attachment.htm>
More information about the CMake
mailing list