Visual Studio 2017 provides built-in support for handling CMake projects. The documentation mostly covers scenarios based on pre-existing cmake projects. But is there any support for creating a cmake project without having to fiddle with the CMakeLists.txt file?
相关问题
- Sorting 3 numbers without branching [closed]
- How to compile C++ code in GDB?
- Why does const allow implicit conversion of refere
- How to know full paths to DLL's from .csproj f
- Importing NuGet references through a local project
相关文章
- How to show location of errors, references to memb
- Class layout in C++: Why are members sometimes ord
- How to mock methods return object with deleted cop
- Which is the best way to multiply a large and spar
- How to track MongoDB requests from a console appli
- C++ default constructor does not initialize pointe
- Selecting only the first few characters in a strin
- What exactly do pointers store? (C++)
EDIT: VS2017 15.6 added an official New Project CMake Wizard
With version 15.6 came the feature of "Create CMake projects from the Add New Project dialog."
This creates a simple ninja based C++ "Hello CMake" project.
A Custom CMake Wizard
Your question and the lack of an existing Wizard inspired me to write one. It's a very basic setup and would most definitely benefit if people with more experience in writing Visual Studio extensions would contribute, but here it is:
https://github.com/FloriansGit/VSCMakeWizards
Edit: Latest VSIX installer is now also available for free on VS Marketplace
https://marketplace.visualstudio.com/items?itemName=oOFlorianOo.CMakeProjectWizards
The new "CMake Executable Template" will show up after a restart of your Visual Studio 2017 under "File/New/Project/Visual C++":
It generates the following files in the given folder and then uses "Open Folder" on it:
Next Steps
Possible next steps would be to:
CMakeLists.txt
I'm looking forward getting feedback on the basic idea. Please add any requests directly to:
https://github.com/FloriansGit/VSCMakeWizards/issues
The Code
And here is the Wizards basic/initial code as a reference:
WizardImplementationClass.cs
Note: The
WizardCancelledException
is necessary, because Visual Studio otherwise would try to generate/open an actual solution. An "Open Folder" kind of project wizard is not yet supported (no SDK API for this).References
As far as I know, there is no Wizard to create a new CMake project, but it can be done by configuring a
CMakeSettings.json
file. https://blogs.msdn.microsoft.com/vcblog/2017/08/14/cmake-support-in-visual-studio-customizing-your-environment/