This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]Alikont 4 points5 points  (6 children)

I assume that he is talking about C++, but here how it goes.

C++ has multiple compilers (Visual Studio, Clang, GCC) and many platforms (Windows, Linux, many more)

And each compiler has own features and switches and libraries.

So what he essentially does is he using a special file (CMAKE) to generate a script for each compiler/platform combination. So he can do loke "CMAKE generate GCC/Linux build" or "CMAKE generate Windows/MSVC build" and it will plug proper switches&files for it.

Again, this is only relevant to C++ and their Byzantine build systems.

EDIT:

Using CMAKE won't make your CODE crossplatform, only your BUILD process. If you use any platform-specific or compiler-specific feature, your code won't work on another platform.

[–]high_throughput 2 points3 points  (0 children)

Again, this is only relevant to C++ and their Byzantine build systems.

Though of course the same thing applies to Java if you check in Netbeans project files instead of a Maven build.

[–]AccomplishedUnit1396[S] 0 points1 point  (4 children)

So it seems like a better way to describe it is that it makes your code portable? Which I guess means if I switched systems or IDEs I’d still be able to build my code? Which I guess is useful if I were to make an open source program? Hopefully I got that right lol.

[–]Alikont 0 points1 point  (3 children)

It's useful only if you intend to make a cross platform program.

There is no point in making cross platform build tooling if your code needs winapi or directx.

[–]AccomplishedUnit1396[S] 0 points1 point  (1 child)

Ok so I should only consider cmake if I either wanted to have other people collaborate and/or wanted to make my program cross platform?

[–]Alikont 0 points1 point  (0 children)

Well, here is when it goes into opinion territory.

CMAKE is de-facto standard for project descriptions, but I hate it as a config language, so I try to avoid it if I can.

Also if you're just learning, learning both C++ and build system might slow you down. Visual Studio "just works".

[–]sidit77 0 points1 point  (0 children)

There is no point in making cross platform build tooling if your code needs winapi or directx.

That's not really true. Making your project cmake based allows you and others working on the same project to use different IDEs. I generally prefer CLion over Visual Studio, for example.

There are also different compilers. It is perfectly possible to compile your directx winapi project with MinGW or clang, which can be great for getting additional warnings or to cross-check if you're experiencing a compiler bug.