Modern CMake for C++

  Рет қаралды 39,475

Smok Code

Smok Code

Күн бұрын

How to build a simple C++ project with CMake? What about advanced projects?
#programming #tech #softwaredevelopment #cmake #cpp
Codes are no longer available.
SECOND EDITION IS OUT!
Get it here: packt.link/G56Ny

Пікірлер: 81
@goodkidsincity
@goodkidsincity Жыл бұрын
I've been reading your book. Thank you for your work!
@StarContract
@StarContract 5 ай бұрын
Do you guys really see no problem that a tool created to simplify the build process has a 400 page manual? 💀
@SmokCode
@SmokCode 5 ай бұрын
What is the problem?
@poopingnuts
@poopingnuts 5 ай бұрын
@@SmokCodeit’s just way too complex. Premake is much easier and simple to understand, learn, and write
@DaKeypunchAr
@DaKeypunchAr 3 ай бұрын
@@poopingnuts i think you can't have more control in premake than in cmake i will buy that book and read it surely.
@SmokCode
@SmokCode 3 ай бұрын
2nd edition is coming mid year!
@aleksandarglisic9384
@aleksandarglisic9384 2 ай бұрын
As software grows in capabilities it grows in complexity and build setups must deal with it. However, if you compress complexity at one end you will make room for more complexity at another end. The cycle is endless, there is no escape from the software samsara. But... for those of us who still want computers, gotta make do with 400 page manuals. That seems like a decent investment in front of endless hours of bestemmie one can get into by using other tools.
@chriscruz429
@chriscruz429 2 жыл бұрын
Ten pages a day times 46 days and boom, you’re done. About a month and a half and you can be fluent with CMake, worth it.
@mqumairi
@mqumairi 2 жыл бұрын
Amazing! Congrats on the book Rafal. An invaluable contribution to the C++ community.
@samdavepollard
@samdavepollard 5 ай бұрын
that rare thing on youtube - someone who knows what they're talking about 🙂 many thanks
@nicodeguyoh66
@nicodeguyoh66 4 ай бұрын
I'm doing undergrad research and I need to write c++ code with more industrial standards. this video was SO helpful, i feel like im going in the right direction. Thanks!
@ilanlee3025
@ilanlee3025 5 ай бұрын
I love that no one really know what cmake does and therefore pretend to explain it but actually gloss over it by saying "cmake will create the appropriate build system" instead.
@OwenWorley1
@OwenWorley1 5 ай бұрын
Great video, thanks! I have ordered your book and have added it to my companies recommended reading list, hopefully this will drive some additional orders!
@chethans5908
@chethans5908 6 ай бұрын
this video's 5-6 mins helped me a lot than lot of videos on youtube
@kingofdice66
@kingofdice66 Жыл бұрын
Great book, can't recommend it enough!
@feraudyh
@feraudyh 7 ай бұрын
Agreed
@felixfigueroa
@felixfigueroa Жыл бұрын
Excellent Focus, it's a great book..!
@sunday-thequant8477
@sunday-thequant8477 11 ай бұрын
next month i will get your book, im massive learning C++
@foxxy4184
@foxxy4184 2 жыл бұрын
BEST BOI CONFIRMED
@user-hgkv65454s
@user-hgkv65454s Жыл бұрын
good work, thanks
@morales5731
@morales5731 2 жыл бұрын
Zaufałem i zamówiłem jeden egzemplarz dla siebie :)
@joymakerRC
@joymakerRC Жыл бұрын
imma buy it now
@AindriuMacGiollaEoin
@AindriuMacGiollaEoin Жыл бұрын
Very interesting book
@TheGwass
@TheGwass Жыл бұрын
Really great book, started learning about CMake and stumbled upon this book recommended from a presentation I went to about it, and it's an amazing book and about so much more than CMake and a whole view of how building things in C++ work and what's involved in it, I'm definitely recommending this to my colleagues because it's a good resource for them to get a better view of everything involved in compilation/building and the pitfalls/issues and how to tune it alongside just learning proper CMake Ps: Any option to get non-expensive shipping to Belgium? I'd love to get a copy at my office for my colleagues but the shipping is like more than half the cost
@SmokCode
@SmokCode Жыл бұрын
I'm glad you're enjoying the book! I don't know what book shops have their presence in Belgium, but some of the biggest ones have license to sell books from Packt in their countries. See if you can find any. Another solution might be buying on Belgian Amazon, which works great if you have a friend with Prime who could order the book for you. www.amazon.com.be/dp/1801070059 If all fails - maybe an ebook would be more suitable? Good luck with your C++!
@TheGwass
@TheGwass Жыл бұрын
​@@SmokCode That works! Amazon had it too since they're in Belgium now. I just had one more question I didn't see addressed in your book and I'm having difficulties finding an answer for. How do you deal with targets with hundreds of source files you want to logically split up a bit as some components/folders might get extracted later on? A giant CMakeLists seems a bit icky, object libraries didn't seem to be a great solution either because then I need to link my interface library to every single one of those. So I don't really know if there's any other good constructs to make a sort of division within a single target
@SmokCode
@SmokCode Жыл бұрын
Within a single target: you can define variables with filenames and add those to sources list. I'd recommend going with libraries though. If there is a logical relationship between files, it creates an opportunity to test them together in integration tests and writing them for smaller scopes is more manageable and quicker to codeloop.
@user-qw9yf6zs9t
@user-qw9yf6zs9t 5 ай бұрын
ive ordered this book a 2-3 weeks ago on amazon yet it has unfortunately not come yet, even admitting its late... dp you know why this is? im not here to rant id just lilke to really know
@elakstein
@elakstein 6 ай бұрын
In my company we use make, what's the benefit of using cmake over c, and if the benefit is huge then why my company is sticking to nake ?
@feraudyh
@feraudyh 7 ай бұрын
There is only one criticism I have of the book: spacing. The book has a crammed look, I feel it would be more attractive if there were more empty lines. I'm referring to the epub version as read by Sumatra.
@SmokCode
@SmokCode 7 ай бұрын
I agree. I'll be sure to forward this comment to the publisher. There's a second edition coming up!
@feraudyh
@feraudyh 7 ай бұрын
@@SmokCode just came down from my office where I was back to reading this incredibly helpful book.
@RussTeeTrombone
@RussTeeTrombone Жыл бұрын
I’m here because I’ve been using your book. QQ - what’s your keyboard?
@kB-hg2ci
@kB-hg2ci 3 ай бұрын
There are plenty of tutorials on cmake and I've scanned quite a few before this one. You answered the most important question within the first minute, what the fuck is a cmake anyways? Thank you
@rafaeldelpino2378
@rafaeldelpino2378 2 жыл бұрын
When will give discount again? I loved It but dolar is Very expensive to us Brazilians 😭
@Loboid
@Loboid Жыл бұрын
Same my country, 1 USD is 11.284 UZS for us, what cost is?
@jonas.caruaru
@jonas.caruaru Жыл бұрын
Is true tho, i mean 6 bucks for 1 dollar is tooo much
@miikavihersaari3104
@miikavihersaari3104 5 ай бұрын
I use an sh-file (and on Windows a bat) that has the command to compile the project, including linking to libs. To further simplify compilation I have a single compilation unit that includes all the other c- or cpp-files.
@SmokCode
@SmokCode 5 ай бұрын
I think you might be misusing the compiler a bit. If you're really including other CPP files, you're treating multiple compilation units as one. This means that a lot of code is being recompiled when it needn't. This approach may work for small projects, but as your codebase grows it slows down exponentially. Consider reading up on SOLID principles, you might be in for a treat!
@miikavihersaari3104
@miikavihersaari3104 5 ай бұрын
@@SmokCode I was being general. I work in game development, and depending on project size I either have two compilation units, system and game, or four, system, graphics, audio and game. Here, system is an API layer I've written that connects the game code to the OS and hardware, and this almost never changes. Graphics, audio and game change often, but in small projects I put them into the same compilation unit. In small projects it takes less than a second to compile and link, and in larger projects so far it's always been less than 10 seconds. But even if I did full recompilations, it seems that the linker still takes almost half of the compilation time. SOLID consist of five principles, but I assume you're particularly referring to dependency inversion, since we're talking about project structuring? In game development it's mostly about knowing the hardware you're developing for, and knowing your data. In the cases where I need this kind of decoupling that DIP offers, I can just use a function pointer. Well, I guess that's a form of dependency inversion too. In general, I don't want to use principles that sacrifice runtime efficiency for a benefit that I can get in other ways. EDIT: I forgot to write that many projects I've seen are structured around an object oriented model, and there's a compilation unit for each different class, and there are dozens, maybe even hundreds, or in large projects thousands of classes. I realize that having only one compilation unit per entire subsystem is very different and might seem strange :)
@wislinonchen8755
@wislinonchen8755 Жыл бұрын
I am reading your book
@fredeisele1895
@fredeisele1895 Жыл бұрын
Is there a way to get the ebook as both a pdf and kindle without buying the book twice?
@SmokCode
@SmokCode Жыл бұрын
I'm sorry to say that I think that's not an option with Packt. If you find out otherwise please let us know
@stef2499
@stef2499 Жыл бұрын
Hope your book is good, been struggling with cmake. Getting the ebook from university library, idk how you get payed by that but frankly i dont care.
@soulextracter
@soulextracter Жыл бұрын
Will your book translate well to use CMake with C instead of C++?
@SmokCode
@SmokCode Жыл бұрын
Some of chapters will. But not all of the book, since I focus on practical use which often means employment of external tools which are often language specific. See the list of chapters and assume that first part works for C, second somewhat works, and third mostly doesn't. If that's enough for you, you'll have a good use of the book. Thanks for your question.
@robertoze
@robertoze Жыл бұрын
It is more than 400 pages, oh my GOD. What about premake?
@jacekkowalski3165
@jacekkowalski3165 2 жыл бұрын
Cześć , mam pytanie czy zamierzasz jeszcze nagrywać po polsku ?
@SmokCode
@SmokCode 2 жыл бұрын
Cześć. W tej chwili nie planuję filmów po polsku.
@r2com641
@r2com641 Жыл бұрын
It’s good that someone writes updated book but - Why would in 2023 I use archaic build system with autistic syntax language? What if we use xmake? Something based on real language and not as slow as Scons ?
@ashutoshchar940
@ashutoshchar940 28 күн бұрын
should i buy first edition or second edition?
@SmokCode
@SmokCode 28 күн бұрын
Second!
@otziotzi2157
@otziotzi2157 Жыл бұрын
I purchased your book today (Sep 1st) and discount code was still valid :)
@randomsoul00
@randomsoul00 6 ай бұрын
so is it only ffor C++??/
@SmokCode
@SmokCode 6 ай бұрын
That's right.
@x_flies
@x_flies Жыл бұрын
Respect if you’re really only using 1 monitor lol.
@mohammedbashir4568
@mohammedbashir4568 9 ай бұрын
if you came from react native document make like ...
@caiubyfreitas
@caiubyfreitas Жыл бұрын
Your explanations is pretty good, the book look nice and I considering to buy it. BUT your video background music SUCKS, Please get rid of it.
@Pyrografpl
@Pyrografpl Жыл бұрын
Kupiłem bo potrzebowałem zacząć z tym tematem. Zdecydowanie lektura nie dla początkujących, po przeczytaniu pierwszych 100 stron nie ma żadnego progresu. Wydaje się że najlepiej najpierw przejrzeć nawet przestarzałe przykłady z sieci, filmik jak hindus stawia VSC z Clang, cmake i ninja, albo inny stack, żeby zobaczyć efekty jak to w ogóle działa i dalej książkę ale najlepiej od środka. No trudno narazie kasa w błoto, może kiedyś temat dojrzeje i będą efekty. Wracam do hinduskich filmów.
@SmokCode
@SmokCode Жыл бұрын
Trochę taki feedback bez konkretu. Nie wiadomo czego dokładnie zabrakło, ani jaki był cel. Książka ma przecież image dockera z pełnym stackiem i można wypróbować wszystko na gotowym.
@tiberiusvetus9113
@tiberiusvetus9113 5 ай бұрын
Do a video on Bazel. I prefer it because it's just simpler than CMake.
@systematicloop3215
@systematicloop3215 Жыл бұрын
Why not compile per platform with the appropriate compiler? Installing these massive build tools feels largely pointless.
@SmokCode
@SmokCode Жыл бұрын
What do you mean? Compilers are the massive build tools.
@systematicloop3215
@systematicloop3215 Жыл бұрын
@@SmokCode I find it far simpler to say something like "gcc hello.c ..." or "cl hello.c ...". It's not much work. It's usually a line or two. It doesn't require me to then install, maintain, and learn an entire suite of commands and syntax. In other words, things like cmake feel redundant. They are solving a problem, rather poorly, when it has already been solved and isn't very complicated to start with.
@SmokCode
@SmokCode Жыл бұрын
Every time you type a command you're redoing the same work you did previously. You may introduce mistakes, and it's not viable to do it on large scale. Even hobby projects often have hundreds of files, and commercial solutions have orders of magnitude more. Keeping track of lengthy commands that change over time is difficult and recompiling everything by default wastes time that quickly adds up.
@SmokCode
@SmokCode Жыл бұрын
I should make a video to explain this in detail..
@diegorocha2186
@diegorocha2186 Жыл бұрын
@@SmokCode Yeah imagine typing "gcc ...." to compile a huge and complex project lol. Maybe he is basing his comments on the project you demonstrated on the video, but this is not even close to real scenarios where you need to manage compilations to different targets and manage dependencies for example! Will be nice if you show some real (open source) projects and how they handle their compilation process. I think serenityos uses cmake to generate the build tree, I don't know if you know this project though.
@banalestorchid5814
@banalestorchid5814 Жыл бұрын
Perhaps I'm suffering from misophonia but the music in the background is REALLY annoying. I'm only 3 minutes in and I don't know if I will be able to get to the end.
@banalestorchid5814
@banalestorchid5814 Жыл бұрын
Nope, gave up before the 5 minute mark. Good luck with the book.
@tiagomelojuca7851
@tiagomelojuca7851 4 ай бұрын
maybe, i barely can hear xD
@user-0xDEEDBEEF
@user-0xDEEDBEEF 2 жыл бұрын
lern Makefile will take less time and effort than read 400 pages book.
@tiagomelojuca7851
@tiagomelojuca7851 4 ай бұрын
🤢🤢🤮🤮🤮
@johnrgrillot9901
@johnrgrillot9901 5 ай бұрын
Thanks for wasting my time with this a commercial for your book
@SmokCode
@SmokCode 5 ай бұрын
No problem!
@tosemusername
@tosemusername 3 ай бұрын
Amazon link seems to be invalid.
@johnluffman7954
@johnluffman7954 Ай бұрын
I thought it was Zelenski teaching C++🤣
How software libraries work?
10:16
Smok Code
Рет қаралды 9 М.
Why CMake?
13:03
sudocpp
Рет қаралды 24 М.
Tom & Jerry !! 😂😂
00:59
Tibo InShape
Рет қаралды 52 МЛН
Backstage 🤫 tutorial #elsarca #tiktok
00:13
Elsa Arca
Рет қаралды 48 МЛН
Homemade Professional Spy Trick To Unlock A Phone 🔍
00:55
Crafty Champions
Рет қаралды 57 МЛН
C++ Super Optimization: 1000X Faster
15:33
Dave's Garage
Рет қаралды 300 М.
how Google writes gorgeous C++
7:40
Low Level Learning
Рет қаралды 795 М.
Networking in C++
32:50
The Cherno
Рет қаралды 231 М.
CMake основы
12:46
S0ER
Рет қаралды 47 М.
15 Years Writing C++ - Advice for new programmers
4:04
SyncMain
Рет қаралды 1,1 МЛН
Do you even test? (your code with CMake)
12:38
Code for yourself
Рет қаралды 18 М.
Modern CMake Modules - Bret Brown - CppCon 2021
1:02:09
CppCon
Рет қаралды 25 М.
CMake - the essential package
27:54
Code for yourself
Рет қаралды 8 М.
Vim Tips I Wish I Knew Earlier
23:00
Sebastian Daschner
Рет қаралды 39 М.
Купил этот ваш VR.
37:21
Ремонтяш
Рет қаралды 297 М.
CY Superb Earphone 👌 For Smartphone Handset
0:42
Tech Official
Рет қаралды 821 М.
Secret Wireless charger 😱 #shorts
0:28
Mr DegrEE
Рет қаралды 1,7 МЛН
Телефон в воде 🤯
0:28
FATA MORGANA
Рет қаралды 1,2 МЛН
Hisense Official Flagship Store Hisense is the champion What is going on?
0:11
Special Effects Funny 44
Рет қаралды 1,7 МЛН