MantisBT - CMake
View Issue Details
0012917CMake(No Category)public2012-01-28 08:012012-09-03 16:02
Peter Kuemmel 
Brad King 
normalminoralways
closedfixed 
Windows
CMake 2.8.7 
CMake 2.8.8CMake 2.8.8 
0012917: Find Visual C++ Express
CMake doesn't find Visual C++ Express and uses "NMake Makefiles" generator by default.

https://github.com/Kitware/CMake/pull/14 [^]
No tags attached.
Issue History
2012-01-28 08:01Peter KuemmelNew Issue
2012-01-28 11:58Rolf Eike BeerNote Added: 0028417
2012-01-28 13:46Peter KuemmelNote Added: 0028418
2012-01-30 08:55Brad KingNote Added: 0028420
2012-01-30 14:02Peter KuemmelNote Added: 0028424
2012-01-30 14:19Brad KingNote Added: 0028425
2012-01-30 14:19Brad KingStatusnew => resolved
2012-01-30 14:19Brad KingResolutionopen => fixed
2012-01-30 14:19Brad KingAssigned To => Brad King
2012-04-19 15:45David ColeFixed in Version => CMake 2.8.8
2012-04-19 15:45David ColeTarget Version => CMake 2.8.8
2012-09-03 16:02David ColeNote Added: 0030877
2012-09-03 16:02David ColeStatusresolved => closed

Notes
(0028417)
Rolf Eike Beer   
2012-01-28 11:58   
Please describe what exactly you did? Just checked out the code and typed "cmake /my/source/dir"? Then specify the correct generator using the -G option. Run "cmake --help" to get a list of all supported generators and their exact spelling.
(0028418)
Peter Kuemmel   
2012-01-28 13:46   
What I did: I called cmake WITHOUT using the -G options.

Without the patch cmake didn't find VC Express and generates "NMake Makefiles" when no -G option is given.

But cmake should generate Visual Studio project files when a version of Studio is installed, this also says the code, cmake.cxx line 2205:

      // Try to find the newest VS installed on the computer and
      // use that as a default if -G is not specified

With the patch cmake could find VCExpress and generates projects files WITHOUT using -G.
(0028420)
Brad King   
2012-01-30 08:55   
In this hunk:

-      std::string vsregBase =
-        "[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\";
+      std::vector<std::string> vsregBases;
+      vsregBases.push_back
+          ("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\");
+      vsregBases.push_back
+          ("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VCExpress\\");
+      vsregBases.push_back
+          ("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\");
+      vsregBases.push_back
+          ("[HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VCExpress\\");


You shouldn't need to list both registry views here. VS is always
installed as a 32-bit application. Just change the call

  cmSystemTools::ExpandRegistryValues(reg);

to

  cmSystemTools::ExpandRegistryValues(reg, cmSystemTools::KeyWOW64_32);

to tell CMake to check the 32-bit view even if it is a 64-bit build.
(0028424)
Peter Kuemmel   
2012-01-30 14:02   
OK, now the patch uses cmSystemTools::KeyWOW64_32.

I also removed the string duplication.
(0028425)
Brad King   
2012-01-30 14:19   
Applied, thanks:

  http://cmake.org/gitweb?p=cmake.git;a=commitdiff;h=453b9e38 [^]
(0030877)
David Cole   
2012-09-03 16:02   
Closing resolved issues that have not been updated in more than 4 months.