How to CMake Good - 0e - CMake in Visual Studio Code

Video Statistics and Information

Video
Captions Word Cloud
Reddit Comments
Captions
hello everybody and welcome back to how to seam a good part zero e in this part we're gonna be talking about using c make within Visual Studio code my personal favorite code editor I'm doing this on Linux but it will work very much the same on Windows and Mac OS as well I'll hop right into it in launch Visual Studio code I won't be creating a new C make project but I'll just open up an existing one now the best way to use C make in Visual Studio code is to use extensions because Visual Studio code does not natively understand out-of-the-box how to work with C make the two you'll want to get our C make and C make tools C make is by TW XS and supplies language support including syntax highlighting and intellisense the next one is C make tools this one's actually by me it provides extra features and tweaks to help support C make based projects in the editor I'll go to the file explorer and we can see a regular C make based project here to configure I'll open the command palette and run CMake configure command supplied by the seaming tools extension before it can configure it'll ask me for a kit to use I'll select the compiler I want to use in this case GCC 7 3 o it will then run the C may configure using the GCC 7 that I requested it also chose to use the ninja C make generator because it can detect ninja on my path you see down below that there was an error it says the doxygen was not found if we go to the problems panel we can see C make tools has found a problem and highlighted it in our C make lists text this is deep within the doxygen C make module so I'll go to where I'm using it in the seeming lists dot txt find the doxygen page and I'll just comment it out I'll rerun the configure without doxygen present if you have Microsoft C and C++ extension installed you'll also see this pop-up saying that C make tools would like to provide intellisense for this folder this let's see make tools provide the C++ extension the information required to compile and parse all of the C and C++ files you have in your project I'll say allow for now next we can go to the seam tab in the Explorer also provided by CMake tools there's a list of targets as well as some directories based on the file system structure of your project the targets are listed within each directory as they appear in their cmakelists txt I can right-click on a target and request it to build C make tools R and C make to build the target I requested I could right-click and build another target as well to make tools also features this built button in the toolbar it will build the target to the right in this case all I'll hit it and it will build all targets I have a compile error but I won't worry about that for now we can change the default build target by clicking the name of the active build target and it will show a drop down of the list of targets we can select to be the default I'll set the simple target as the default target you can also press f7 to build the default target from this little triple dot I can say clean the project and it'll clean out all the built files the small hammer icon next to a target name indicates that it is the default build target I can also right-click on any executable target and run it in the terminal this will also cause C make tools to build it before it runs you can see this was a test and it had a test failure we can open up the file that it was named Unicode CBP go to line 82 set a breakpoint right click on the executable and run the target with a debugger it hit my breakpoint I didn't need to configure the launch JSON or any other debugging options in Visual Studio code to get the debugger to work this is the very basics of how to use C make in visual studio code check online for more documentation about using Visual Studio code and how to use C make tools and all its features this was a shorter episode but in the future I'm going to be using Visual Studio code to control C make and not run C make from the command line is often check the video description for any errata links addenda or other important information in the next few episodes we'll start focusing more on using C make directly until next time keep C making
Info
Channel: vector-of-bool
Views: 75,736
Rating: undefined out of 5
Keywords: cmake, vscode, visual studio code, visual studio, tutorial
Id: wP4cwAtU-g8
Channel Id: undefined
Length: 4min 28sec (268 seconds)
Published: Sun Aug 12 2018
Related Videos
Note
Please note that this website is currently a work in progress! Lots of interesting data and statistics to come.