CMake and editing code - visual-studio

I have seen many open-source projects use CMake as their build system. I'd like to use it too, but so far all of my development has been on Visual Studio (2015). This makes me wonder how I'm supposed to edit code when using CMake as a build system? Should I use editors like Vim or emacs, or can I still use Visual Studio (with IntelliSense, if possible)?

You can use CMake to generate Visual Studio solution for you:
https://cognitivewaves.wordpress.com/cmake-and-visual-studio/
But unfortunately the opposite is not possible(or harder than expected), for every new file or include folder generation you will have to update your CMakeLists.txt file respectively(edits do not require updating CMake), looking at the Visual Studio flags while compiling could help this, but the process is still manual:
Using CMake to generate Visual Studio C++ project files
cmake creating visual studio solution on the command line
There are also 3rd Party tools which could facilitate the production cycle for you, including the visual studio to CMake generation, but they are not officially supported

Related

Visual Studio 2010 express compiler

I would like to know if I can somehow compile c++ code in visual studio express 2010 with a 2019/2022 compiler. I only want to use express 2010 as an editor. I get no results on google regarding this topic.
Edit: I can change from platform toolset V100 to V90 but I'd like V143 like VS 2022. Is it possible though?
It is possible, but why on earth would you want to continue using Visual Studio Express 2010 as your IDE? VS2022 is so full of goodies and the community edition is free to use.
That being said: The VS2019/VS2022 compilers are just cl.exe, link.exe etc... You can use these compilers instead of the VS2010 cl.exe, link.exe etc... The VS2010 integrated build system will not automatically find them, so you'll either have to fiddle around with paths, get in to trouble with compiler switches etc...
You could switch to makefiles (or CMake) to use the compilers and keep the IDE. VS2010 is then no more than a fancy editor.
Tip: Try compiling your code from the command line (cmd.exe) to get started. Or download VS2022 community edition.

How to use newest MSVC compiler (2017) in old Visual Studio (2010)?

I have a weak computer and the interface of modern Visual Studios (2015/2017) works extremely slowly on it. I'm satisfied with the speed and functionality of the interface of Visual Studio 2010, but I want to use the latest features of C++.
How can I connect the compiler and debugger of VS2017 toolset to the VS2010 IDE?
I'm not sure you can do that. You can try changing the toolset directories. But I highly doubt that will work.
But I can suggest other approaches:
- switch off intellisence and other features of VS
- uninstall VS packages you do not need
- Try Visual Studio Code instead. If you are not tied to Windows, get a Linux OS and use it with Visual Studio Code.
- Otherwise use another editor to code in (like notepad++) and use only the command line to build projects (you cant use the debugger in that case)

how to create .exe from CEF source code on windows (without using Visual studio)

i have downloaded CEF binaries from the link http://opensource.spotify.com/cefbuilds/index.html as successfully created a .sln file using VS 2017.
But now our requirement is to compile the cef binaries on windows through MinGW or through command line(Do not want to use Microsoft visual studio).
can someone helpme out with this thing?
Only Visual Studio is officially supported to build CEF on Windows. You'll unlikely be successful to make a different compiler work in a reasonable time.
There is also ways to compile a VS project via the command line. Example: msbuild project.sln /Flags... For more details have a look at this stackoverflow link
If you ever want to compile libcef (Chromium) for Windows, the whole build is entirely command-line only despite using the Visual Studio compiler.
There is a free edition of Visual Studio called Visual Studio Community (used to be Visual Studio Express):
https://www.visualstudio.com/vs/community/
Also, if you are a small company, you might want to check out Microsoft's Action Pack for 400 EUR/year which includes 3 Visual Studio Prof. subscriptions.
Have a look at the CEF wiki:
https://bitbucket.org/chromiumembedded/cef/wiki/MasterBuildQuickStart.md
I do not have enough points to comment on Eugen. Maybe someone can edit.
I think Eugen is right, and VS is a must. I suggest flowing also this link to learn how to build CEF programmatically and on different OS.

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.

Xcode project to Visual Studio

I do most of my home development in Xcode, however my classes require me to use Visual Studio 2010. I am curious if there is some tool that can convert my Xcode project to Visual Studio projects and back and structure the files the way the ides want them to be?
The programs I am writing are OS independent.
You might want to consider using a meta-make such as CMake that can generate both Visual Studio and Xcode project files.
It's probably not as ideal for you since you'll need to write the CMake file and then fix up both the Xcode and Visual Studio projects to your liking (though I believe CMake has some support for project organisation in Visual Studio—not sure about Xcode) rather than doing a straight conversion, but it would allow you to work in Xcode and submit as a Visual Studio project.

Resources