----- On Nov 8, 2016, at 8:13 AM, Taylor Braun-Jones tay...@braun-jones.org wrote:
> On Fri, Nov 4, 2016 at 2:55 PM, Brad King <brad.k...@kitware.com> wrote: >> >> On 11/03/2016 06:04 PM, John Drescher wrote: >> > I opened a project in cmake-gui using the open project button from a >> > vc 2010 build of a project. The open project opened the project in >> > Visual Studio 2010. Later I opened the same project but a different >> > build tree for Visual Studio 2013 CMake-gui had all of the correct >> > information for the Visual Studio 2013 build but open project tried to >> > open the Visual Studio 2013 solution in Visual Studio 2010 instead of >> > the expected Visual Studio 2013. I'm unable to reproduce this problem. I have multiple Visual Studio installations of different versions. I'm not sure whether it could be specific to a project, or specific to installations of visual studio. > > I'm guessing you established MSVS2010 as the default application for > opening .sln files the first time you used the open project button. > What happens if you double click on that MSVS2013 .sln file? > >> The feature is new in 3.7 and was contributed here: >> >> cmake-gui: Add button to open the generated project >> https://gitlab.kitware.com/cmake/cmake/commit/1ca2d5d1 >> >> I'm not particularly familiar with how it works, but from a quick >> glance at the code it may be using file associations. > > Yes, it's just using Windows file file associations, but it shouldn't. > Since it's possible (and fairly common) to have more than one version > of Visual Studio installed on a system the Open Project button should > be smarter and use ${CMAKE_VS_DEVENV_COMMAND} to open the .sln file. > It should be something like this: > > MSVS2015: %VS140COMNTOOLS%..\IDE\devenv.com > MSVS2013: %VS120COMNTOOLS%..\IDE\devenv.com > MSVS2012: %VS110COMNTOOLS%..\IDE\devenv.com > MSVS2010: %VS100COMNTOOLS%..\IDE\devenv.com > > If the correct devenv.exe path does not exist or can't be determined > for some reason, then I guess it makes sense to fall back to using > `QDesktopServices::openUrl` to try to open the .sln file with the > Windows file associations. It is already using QDesktopServices::openUrl(QUrl::fromLocalFile(...)) AFAIK, that is the correct way to do it. The .sln file should already know what version of Visual Studio it wants to be opened in. Clint -- Powered by www.kitware.com Please keep messages on-topic and check the CMake FAQ at: http://www.cmake.org/Wiki/CMake_FAQ Kitware offers various services to support the CMake community. For more information on each offering, please visit: CMake Support: http://cmake.org/cmake/help/support.html CMake Consulting: http://cmake.org/cmake/help/consulting.html CMake Training Courses: http://cmake.org/cmake/help/training.html Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html Follow this link to subscribe/unsubscribe: http://public.kitware.com/mailman/listinfo/cmake