[CMake] Problem with Visual Studio 2010, Windows 7 64bit
Andrew Maclean
andrew.amaclean at gmail.com
Wed Nov 28 20:00:02 EST 2012
Hi David,
I agree with what you are saying. Just to confirm it I built a series of
programs (67 in the solution) that use boost (by using CMake as you
describe below) for Visual Studio Express 2010 and 2012 (both 64-bit
builds). CMake had no trouble finding the relevant build environment for
VS2010 and VS2012. This confirms that CMake works as expected and also
there is no need to modify the build environment when using the IDE.
However if you build from a command line using devenv, msbuild or nmake
then you will need to set the appropriate environment for VS2010 or VS2012
but I would do this after running the cmake-gui by double-clicking on the
icon as David mentions below.
Let CMake set up everything first and then if you want to use a command
prompt, use the relevant VS batch file to set up the environment in the
command window.
By the way I think the VS2012 compile is faster then the VS2010 compile,
in the above case 45s vs 51s.
Regards
Andrew
> ---------- Forwarded message ----------
> From: David Cole <david.cole at kitware.com>
> To: Michael Jackson <mike.jackson at bluequartz.net>
> Cc: "cmake at cmake.org MailingList" <cmake at cmake.org>
> Date: Wed, 28 Nov 2012 08:17:24 -0500
> Subject: Re: [CMake] Problem with Visual Studio 2010, Windows 7 64bit
> You should never allow Visual Studio or CMake installers to make changes
> to your environment.
>
> They are unnecessary and cause complications when multiple versions are
> installed.
>
> When I use cmake-gui, I double-click an icon on my desktop, or start it
> from an icon in the start menu. I almost never run it from a Visual Studio
> command prompt. It's unnecessary...
>
> Visual Studio knows all about its own installation and environment, and so
> there's no need to allow it to modify your machine's environment. That's
> what the command prompt shortcuts are for: when you need the environment,
> you can just run the command prompt with it, and use it as needed. But for
> typical VS only use, it's never needed.
>
> So: moral of the story from my point of view is: minimize environment
> changes from all installers... Things should work without environment
> changes, and if they don't... that's a bug.
>
>
> 2 cents,
> David C.
>
>
>
>
>
> On Wed, Nov 28, 2012 at 7:59 AM, Michael Jackson <
> mike.jackson at bluequartz.net> wrote:
>
>>
>> On Nov 28, 2012, at 7:37 AM, David Doria <daviddoria at gmail.com> wrote:
>>
>> > On Wed, Nov 28, 2012 at 4:22 AM, Andrew Maclean
>> > <andrew.amaclean at gmail.com> wrote:
>> >> Interesting ... I have no problems, the only thing I can think of is
>> that I
>> >> had VS 2010 SP1 installed before I installed VS 2012 Express, I did
>> not use
>> >> any of the RC versions.
>> >
>> > Petr,
>> >
>> > A colleague mentioned that with the same setup he was getting the same
>> > error, and then installed SP1 for VS 2010 and things started working.
>> > It would really be great if there were better checks/errors because it
>> > is really a huge barrier for projects like VTK to get users to fight
>> > through install problems. "Hey you should use VTK for that" works when
>> > they have to follow a few instructions and it works, but when they
>> > have to spend days working through cryptic errors most tend to give up
>> > and then we lose a user.
>> >
>> > Andrew,
>> >
>> > I'm almost certain that it will never work using the VS generators
>> > (with very different "can't find the compiler type of errors") unless
>> > you run cmake-gui from a terminal unless you have manually added many
>> > VS things to the system environment variables. At least that has been
>> > my experience on many machines.
>> >
>> > David
>> > --
>>
>>
>> Here is my theory on mixing visual studios. When you install Visual
>> Studio Windows will dutifully add the Visual Studio tools to the PATH for
>> everyone. This is why you can just launch CMakeGui and have the Visual
>> Studio generators work correctly. All is well. This is where I ran into
>> problems.. Now install Visual Studio 2012 (or any other version) alonside
>> VS2010 and Windows will again the 2012 to the PATH also. Now you have BOTH
>> VS version's tools in the path but what ever is found FIRST is the one that
>> is going to be used which will cause problems when launching CMakeGUi from
>> Windows Explorer. At least this is what I saw years ago and why I NEVER mix
>> versions. I install each version into its own Virtual Machine and run that
>> way. It avoids all of these PATH issues.
>> Unless CMake has some code to look into the registry to fully
>> determine which compiler you want and setup the environment correctly by
>> removing PATHS from a version of Visual Studio that you are NOT using I
>> don't see how having more than a single Visual studio installed is going to
>> work***
>>
>>
>> *** It can work if you go into the "Environment Variables" for Windows
>> and REMOVE any and all references to Visual Studio. Then when you want to
>> configure a project you launch a "Visual Studio Command Prompt" or "Visual
>> Studio x64 Command Prompt" and then launch CMake-gui from there which will
>> properly setup the environment for you and the generator will work
>> correctly every time because there is no mixing of paths. This is how I do
>> it. Yes it is a few extra clicks and some typing but it avoids days of
>> fighting hidden path issues.
>>
>> Of course I could be wrong on most of the above but it works for me for
>> the last 3 years so I am not about to change. Just my nickels worth of
>> advice.
>> ___________________________________________________________
>> Mike Jackson Principal Software Engineer
>> BlueQuartz Software Dayton, Ohio
>> mike.jackson at bluequartz.net www.bluequartz.net
>>
>> --
>>
>> 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
>>
>
>
>
> --
___________________________________________
Andrew J. P. Maclean
___________________________________________
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.cmake.org/pipermail/cmake/attachments/20121129/db9583b2/attachment.htm>
More information about the CMake
mailing list