MantisBT - CMake
View Issue Details
0007095CMakeCMakepublic2008-05-25 16:142008-05-27 16:52
Peter Johnson 
 
normalminoralways
closedfixed 
CMake-2-6 
 
0007095: Win32 cmake fails to find some x64 executables
On Windows x64, the 32-bit executable of cmake fails to find some 64-bit programs such as 64-bit Python. This is probably due to the fact that by default registry lookups by 32-bit executables are redirected to a special 32-bit subtree (Wow6432Node) that does not contain the 64-bit Python registry key. Either cmake should search both the 64-bit tree and the 32-bit subtree or a 64-bit version of cmake should be provided for Windows.
No tags attached.
related to 0006814closed Brad King 32-bit Java not found by 64-bit CMake on Windows. 
Issue History
2008-05-25 16:14Peter JohnsonNew Issue
2008-05-27 13:27Brad KingNote Added: 0012122
2008-05-27 13:39Brad KingNote Added: 0012123
2008-05-27 13:45Brad KingNote Added: 0012124
2008-05-27 14:47Brad KingNote Added: 0012125
2008-05-27 14:48Brad KingNote Added: 0012126
2008-05-27 14:49Brad KingStatusnew => closed
2008-05-27 14:49Brad KingNote Added: 0012127
2008-05-27 14:49Brad KingResolutionopen => fixed
2008-05-27 16:26Peter JohnsonStatusclosed => feedback
2008-05-27 16:26Peter JohnsonResolutionfixed => reopened
2008-05-27 16:26Peter JohnsonNote Added: 0012129
2008-05-27 16:32Brad KingNote Added: 0012130
2008-05-27 16:52Brad KingStatusfeedback => closed
2008-05-27 16:52Brad KingNote Added: 0012131
2008-05-27 16:52Brad KingResolutionreopened => fixed
2008-06-06 11:54Brad KingRelationship addedrelated to 0006814

Notes
(0012122)
Brad King   
2008-05-27 13:27   
I just came across the same bug (for the same reason...64-bit python on windows). Your analysis of the registry node was my thought also.

I think the correct fix is for CMake to search the 32-bit registry node or the 64-bit registry node depending on the *target* platform for which the project will be built. Whether CMake itself was built 32-bit or 64-bit does not matter.
(0012123)
Brad King   
2008-05-27 13:39   
For reference, MS documents details of the registry rewriting here:

http://support.microsoft.com/kb/896459 [^]
(0012124)
Brad King   
2008-05-27 13:45   
Furthermore, 32-bit and 64-bit apps can explicitly request the other view:

http://msdn.microsoft.com/en-us/library/aa384129(VS.85).aspx [^]
(0012125)
Brad King   
2008-05-27 14:47   
I've updated the internal API we use to access the registry to support selection of 32-bit and 64-bit views:

/cvsroot/CMake/CMake/Source/cmSystemTools.cxx,v <-- Source/cmSystemTools.cxx
new revision: 1.379; previous revision: 1.378
/cvsroot/CMake/CMake/Source/cmSystemTools.h,v <-- Source/cmSystemTools.h
new revision: 1.154; previous revision: 1.153
/cvsroot/CMake/CMake/Source/kwsys/SystemTools.cxx,v <-- Source/kwsys/SystemTools.cxx
new revision: 1.226; previous revision: 1.225
/cvsroot/CMake/CMake/Source/kwsys/SystemTools.hxx.in,v <-- Source/kwsys/SystemTools.hxx.in
new revision: 1.74; previous revision: 1.73
(0012126)
Brad King   
2008-05-27 14:48   
I've updated the FIND* commands to use the view of the target platform when reading registry values:

/cvsroot/CMake/CMake/Source/cmFindBase.cxx,v <-- Source/cmFindBase.cxx
new revision: 1.39; previous revision: 1.38
(0012127)
Brad King   
2008-05-27 14:49   
I just tried this, and it works. A 32-bit or 64-bit CMake binary can now find 64-bit python when building a 64-bit project. We'll include this in the next 2.6 release.
(0012129)
Peter Johnson   
2008-05-27 16:26   
Unfortunately this doesn't completely fix the issue for me. In my case, I'm using Python to generate source code (e.g. running a Python script as part of the build process with ADD_CUSTOM_COMMAND), so it shouldn't matter what the target platform is. E.g. even if I'm building a Win32 target, using the 64-bit Python is fine. Is there a reasonable way in which this can be supported? I think this falls under build vs. target platform for FIND*?
(0012130)
Brad King   
2008-05-27 16:32   
For finding libraries we have to use the target platform.

For finding executables I guess we can support finding them for either the host or target platform.
(0012131)
Brad King   
2008-05-27 16:52   
Okay, now find_program() will expand registry values to both the 32-bit and the 64-bit values. The target platform is checked first just in case. Now I can find a 64-bit python.exe when building a 32-bit project.

/cvsroot/CMake/CMake/Source/cmFindBase.cxx,v <-- Source/cmFindBase.cxx
new revision: 1.40; previous revision: 1.39