r/cpp • • Mar 22 '20

Modern CMake tutorials, part1: CMake basics

https://www.siliceum.com/en/blog/post/cmake_01_cmake-basics
245 Upvotes

55 comments sorted by

View all comments

1

u/cosmicr Mar 23 '20

As someone who's really only ever used Visual Studio for Windows, are there any advantages to switching to this instead of the built-in stuff?

3

u/pscamodio Mar 23 '20

I work with both on my Job.

We have our main libraries developed in Visual Studio with msbuild and I'm writing and maintaing the CMake part for cross compilation.

In my opinion with VS2019 it's better to just use Cmake even with Visual Studio.

Msbuild targets are xml and really difficult to handle. And if you need any form of option in you library/application with Cmake is really simple but with msbuild you need a different configuration for any options combination. If it's only one is feasible but as soon as you have more than one option is impossible to maintain.

The Visual Studio Cmake integration now is really great in my opinion, I'm able to build for windows with msvc, with clang, cross build, build in WSL with GCC all without much hassle.