[CMake] visual studio macros

Tom Deblauwe tom.deblauwe at traficon.com
Wed Jan 25 11:41:10 EST 2012


Hello,

I have tried with the pre-built ones, but those don't detect visual 
studio 2005 SP1 correctly on windows 7 64-bit. I had to change the code 
to the version below.
I needed to add the "Wow6432Node" in the registry key path. Also, the 
VisualStudioProjectsLocation registry key was not there, but the 
VisualStudioLocation key was available on windows XP and on win7. So I 
constructed the path using that instead. Now it works for me.

Best regards,
Tom,

   // Some VS8 sp0 versions cannot run macros.
   // See http://support.microsoft.com/kb/928209
   const char* vc8sp1Registry =
     
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\"
     "InstalledProducts\\KB926601;";
   const char* vc8exSP1Registry =
     
"HKEY_LOCAL_MACHINE\\SOFTWARE\\Wow6432Node\\Microsoft\\VisualStudio\\8.0\\"
     "InstalledProducts\\KB926748;";
   std::string vc8sp1;
   if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1) &&
       !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1))
     {
     return "";
     }

   std::string base;
   std::string path;

   // base begins with the VisualStudioProjectsLocation reg value...
   if (cmSystemTools::ReadRegistryValue(
     "HKEY_CURRENT_USER\\Software\\Microsoft\\VisualStudio\\8.0;"
     "VisualStudioLocation",
     base))
     {
     cmSystemTools::ConvertToUnixSlashes(base);

     // 8.0 macros folder:
     path = base + "/Projects/VSMacros80";
     }


Op 25/01/2012 17:34, David Cole schreef:
> After emailing directly with Tom, I realized I misinterpreted this
> code when I replied to the list....
>
> He has the problem with a 64-bit build of CMake itself, I think:
>
> "You built a 64-bit CMake? That might be the explanation. Try building
> a 32-bit one instead. Or simply use Kitware's pre-built 32-bit
> binaries. They work just fine on 64-bit Windows systems..."
>
> Tom, please let us know if a 32-bit CMake fixes this issue for you or not.
>
>
> Thanks,
> David C.
>
>
> On Tue, Jan 24, 2012 at 10:28 AM, David Cole<david.cole at kitware.com>  wrote:
>>  From the CMake source code file Source/cmGlobalVisualStudio8Generator.cxx:
>>
>> //----------------------------------------------------------------------------
>> std::string cmGlobalVisualStudio8Generator::GetUserMacrosDirectory()
>> {
>>   // Some VS8 sp0 versions cannot run macros.
>>   // See http://support.microsoft.com/kb/928209
>>   const char* vc8sp1Registry =
>>     "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\"
>>     "InstalledProducts\\KB926601;";
>>   const char* vc8exSP1Registry =
>>     "HKEY_LOCAL_MACHINE\\SOFTWARE\\Microsoft\\VisualStudio\\8.0\\"
>>     "InstalledProducts\\KB926748;";
>>   std::string vc8sp1;
>>   if (!cmSystemTools::ReadRegistryValue(vc8sp1Registry, vc8sp1)&&
>>       !cmSystemTools::ReadRegistryValue(vc8exSP1Registry, vc8sp1))
>>     {
>>     return "";
>>     }
>>
>>
>> Since you mention you have SP1 installed, (KB926601), we skip copying
>> the macros files for your installation since we know they will not
>> work. We also will not even try to call the macro, even if you copy it
>> into place by hand. See the Microsoft URL in the source code comment
>> for more details...
>>
>> If you want to try to use this functionality anyway, you'll have to
>> modify CMake's code to avoid the return statement in the above code.
>>
>>
>> HTH,
>> David
>>
>>
>> On Tue, Jan 24, 2012 at 5:10 AM, Tom Deblauwe<tom.deblauwe at traficon.com>  wrote:
>>> Hello,
>>>
>>> I'm running a Windows 7 64 bit OS, and I'm using visual studio 2005 with
>>> service pack 1. Below is the list of versions. Now my question is: how can I
>>> manually check that all macro stuff works and is configured correctly? In
>>> other words: how can I install the macro's manually? They are definitely not
>>> showing up automaticaly in the "macro explorer". Also, when is the time that
>>> CMake installs those macros in visual studio? Is it when the project files
>>> are generated or at install time of cmake itself? How are the macros then
>>> eventually run, what triggers them?
>>>
>>> Best regards,
>>> Tom,
>>>
>>> Microsoft Visual Studio 2005
>>> Version 8.0.50727.867  (vsvista.050727-8600)
>>> Microsoft .NET Framework
>>> Version 2.0.50727 SP2
>>> Microsoft Visual Studio 2005 Professional Edition - ENU Service Pack 1
>>> (KB926601)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB2251481)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB2465367)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB2538218)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB2548826)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB937061)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB971023)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB971090)
>>> Security Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB973673)
>>> Update for Microsoft Visual Studio 2005 Professional Edition - ENU
>>> (KB932232)
>>>
>>> --
>>> Tom Deblauwe
>>> R&D Engineer
>>>
>>> Traficon International N.V.
>>> Vlamingstraat 19
>>> B-8560 Wevelgem
>>> Belgium
>>> Tel.: +32 (0)56 37.22.00
>>> Fax: +32 (0)56 37.21.96
>>> URL: www.traficon.com
>>>
>>> --
>>>
>>> Powered by www.kitware.com
>>>
>>> Visit other Kitware open-source projects at
>>> http://www.kitware.com/opensource/opensource.html
>>>
>>> Please keep messages on-topic and check the CMake FAQ at:
>>> http://www.cmake.org/Wiki/CMake_FAQ
>>>
>>> Follow this link to subscribe/unsubscribe:
>>> http://www.cmake.org/mailman/listinfo/cmake

-- 
*Tom Deblauwe*
*R&D Engineer*

Traficon International N.V.
Vlamingstraat 19
B-8560 Wevelgem
Belgium
Tel.: +32 (0)56 37.22.00
Fax: +32 (0)56 37.21.96
URL: www.traficon.com <http://www.traficon.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20120125/91eca3aa/attachment.htm>


More information about the CMake mailing list