How to add an existing cmake project to the Visual Studio Solution - visual-studio

I am using Visual Studio 2017 and I have a solution consisting of several projects mainly in C++. Now I want to add an existing C++ project which using CMake for building to my solution in visual studio and build it along with other projects in solution. Is it possible to do that? FYI, I can build the cmake project separately in Visual Studio.

Related

Visual Studio 2015: How to automate cmake operations?

I'm using Visual Studio 2015 Enterprise Edition. I followed this tutorial
https://www.youtube.com/watch?v=IgvbhyDh8r0
Like Visual Studio creates a .sln file when any new project is saved and then on building it executes it to build the project, in the case of this VTK tutorial, it uses CMake to create the build file .sln for Visual studio to execute. Is there any way I can automate/replace the process of CMake using Visual Studio only?
PS- Just ignore if I have any misunderstanding of the concepts as I'm totally new to this and was not able to find proper documentation on it.
After you've generated a .sln file once, you don't need to run CMake manually again. It hooks itself into ZERO_CHECK project, so it would regenerate the solution every time you change CMakeLists.txt.
But you can't do with VS only, as you have to generate .sln for the first time.

How to use MSBuild proj files for packaging the bits in Visual Studio Team Foundation Server 2015 using Visual studio Build definition

I am trying to build the project using Visual studio build, the build is happening fine, but now I want to package the bits i.e (package and configuration files) for that I am using a MSBuild proj files but how to give it as input to VS build in Visual Studio Team Foundation Server.
Its not possible using VSTF 2015 .
https://msdn.microsoft.com/en-us/library/vs/alm/build/vs/define-build

Can I use qt5 in visual studio without the add-in?

I understand I can use Qt5 in Visual Studio by using the Visual Studio Add-in for Qt as mentioned in Building Qt5 with Visual Studio 2012 / Visual Studio 2013, and integrating with the IDE.
Is it possible to use Qt5 in Visual Studio without using the Add-in?
Also, I would like to use CMake to generate the Visual Studio Project.
Yup.
I have it working for a pretty complex subdirs template.
Qmake can generate the visual studio solution file and vcxproj, look here:
http://doc.qt.io/qt-5/qmake-platform-notes.html#creating-visual-studio-project-files
What I do is use the Qmake project as the master project, and generate the VS stuff out of folder as temporaries. This prevents Visual studio from tangling up in your source files as well as in the qmake stuff. And you can also port it to other OSs without any hassle. Using this approach, if you want to add files to your project, don't do it through VS, but add it to the .PRO file and re-run qmake.
The only thing (that I've found) is if you change anything that needs to be MOC'd, then re-run qmake.
If you want CMake exclusively then this is a nice guide
http://www.kdab.com/using-cmake-with-qt-5/.
The qmake way is a little cleaner as you don't get all the extra noise of finding Qt libraries as you need in CMake.

Regenerate T4 template after each build on build server without Vistual Studio

My solution file contains many projects which consist of many template files and I want regenerate each template after or before build on the project. I know how to do that locally, but I have problem how to do that on build server where Visutal Studio is not installed. Do you have any sollutions?
I know that are two sollutions form this source: Get Visual Studio to run a T4 Template on every build :
a) Visual Studio Visualization and Modeling SDK - i have to install visual studio (except Express Edition) and i can't do that
b) use TextTransform.exe tool, but then I have problems with missing dlls in GAC
Regards
With Visual Studio 2010 SP1 and the Visual Studio Visualization and Modeling SDK for Visual Studio 2010, you're licensed to copy and redistribute the necessary files to do T4 transforms at build time on a build server (note, only a build server, not arbitrary redistribution). You can simply copy these files from a machine with Visual Studio and the SDK installed.
The two license files in question are:
1) buildserver.txt in the Visual Studio install directory
2) redist.txt in the VisualStudioIntegration\Tools\DSLTools directory of the SDK.
I have found solution;)
For regenerate T4 templates file i use solution described by Cheburek from this page Get Visual Studio to run a T4 Template on every build. But if I want to use Cheburek solution on build server without Visual Studio installed I need to add following dll files to GAC, and then everything is OK:)
1) Microsoft.VisualStudio.TextTemplating.10.0.dll
2) Microsoft.VisualStudio.TextTemplating.Interfaces.10.0.dll
Regards

DebuggingVisualizer targeting multiple versions of Visual Studio

Is it possible to build a Debugging Visualizer that can be used in multiple versions of Visual Studio?
A Debugging Visualizer has to reference Microsoft.VisualStudio.DebuggerVisualizers.dll and there is a separate version of the assembly for every version of Visual Studio. It seems that these versions are not compatible. For example, if I built a visualizer that references Microsoft.VisualStudio.DebuggerVisualizers v9.0, it can be used in Visual Studio 2008, but not in Visual Studio 2010.
I am looking for a way to target at least Visual studio 2008 and Visual Studio 2010 while maintaining only one project for the visualizer. Duplicating the project and changing only references to Microsoft.VisualStudio.DebuggerVisualizers will work, but it creates a maintenance horror.
If your code base is exactly the same for both referenced assemblies then I would suggest the same approach as I've suggested in this question: Visual Studio Installer -- Change application resource
The idea is to have 1 project where you will have a MSBuild property which VS to target and depending on this property you may reference either VS 2008 or VS 2010 DebuggerVisualizers assembly.
The only other solution I see is the one you've mentioned - having 2 separate project files to target different VS version. I do not think it will be that difficult to maintain two versions if you will not duplicate code. And you can avoid duplicating code by including code files as links into your projects.

Resources