Explain CMake to me

explain CMake to me

Attached: 172-1722487_business-finance-smart-wojak-hd-png-download.png.jpg (840x849, 295K)

It's bad

but why do I need it? how do I use it?

It generates build scripts for various toolchains, making it easier to support multiple compilers and platforms.
It's bad but not as bad as makefile.

You don't use it.

premake

Holy fuck, this board is absolutely useless for anything except riced out desktops with pictures of anime girls in schoolgirl outfits.

The defacto build system next to classic make and autogen. Use xmake.

lol i think this every thread i go in

It's garbage, almost as bad as qmake

You are a useless newfag weeb that don't have a fucking job, go kill yourself you nigger.

man cmake

>not as bad as makefile.
please explain to me why makefile is bad

its kind of a clusterfuck because the """correct""" way of doing things has changed alot from version to version but the basic jist of it is this:
1. create a target with either add_executable or add_library
2. specify target properties with various target specific functions like taget_include_directories, set_target_properties, target_link_libraries()
3. if you want your target to be usable by other CMakeLists scripts you need to call the install() command on the target & then specify an export group & then you need to call the install command again on the export group, to generate a cmake script that exposes your target & can be found with FindPackage().

ex:
cmake_minimum_required(VERSION 3.8)
project(MyProject)

FindPackage(MyDependency REQUIRED)

add_library(MyLib "mainer.cpp")
target_link_libraries(MyLib PRIVATE MyDependency)

install(TARGETS MyLib EXPORT MyExportGroup DESTINATION "lib")
install(EXPORT MyExportGroup DESTINATION "lib/cmake/MyLibConfig.cmake")

##you can also install directories like this
##install(DIRECTORY "${CMAKE_SOURCE_DIR}/include" DESTINATION "include")

excessive boilerplate, also configs are a pain in the ass

banner material right there

I don't think anyone can explain cmake, it's just that terrible

It works like make but with an added C in the beginning. Actually the C means C language invented by Dennis Ritchie.

what is make

the old unix buildsystem

I've been putting off lesrnkng how to use make or cmake and by what I'm seeing here there both trash. So now I have to ask what is the best build system out there for large multifile c++ projects

Cmake is pretty much the only one that is widely adopted I'm afraid

that’s the thing it’s still cmake
it’s trash
no one like it
it’s poorly documented on purpose to sell books
but it’s also the best supported and widely used one with the most features

meson is the other option, it's mostly the same but with cleaner syntax

PEBKAC, i never had a problem with the documentation and never needed to buy a book

Well that's something to hear, what are the alternatives because I'm only ever just working on personal projects. Right now I'm using a Python file that goes through the src directory and adds it all to one big g++ command. Was thinking about improving it to make it so it doesn't compile the whole program everytime

this is where cmake actually helps
using ninja as the generator will only recompile shit when stuff changes
managing this is a bigger problem it sounds so using a proper solution is a good idea

>t. cmake dev
cmake is shit, even autotools is better than it

Make is basic as hell, but at least it's also simple. I have no interest into wading into the mess that is CMake.

Where's that picture of that video game character shooting himself after seeing some cmake scripts? It's exactly like that.

autotools is unfortunately the slowest piece of shit imaginable

Put me in the screencap

Attached: 1561321517974.gif (320x289, 150K)

./configure
make
make install

You don’t need anything else

Try Meson for some time to see how it should look like.
Then try to convert the knowledge to """Modern CMake""", as it is what it aims to achieve.

achieving robust recompilation with hand-written Makefile is almost impossible

cmake .
cmake --build . --target install

Will this work for everything

ye pretty much

cmake isn't as bad as people are making it out to be tbqh. Sure it lacks proper documentation & the dsl is a clusterfuck but once you get past that it does a pretty good job of providing a cross platform build + packaging system (with cpack).

I'd rather use cmake to generate a makefile any day of the week.

fpbp

What do you mean by that?

DLate

and that's a good thing!

Attached: 1515341248500.jpg (1200x800, 115K)