HomeНаука и техникаRelated VideosMore From: Jason Turner

C++ Weekly - Ep 78 - Intro to CMake

602 ratings | 37076 views
Support these videos: https://www.patreon.com/lefticus Learning C++ Best Practices: http://shop.oreilly.com/product/0636920049814.do Inheritance and Polymorphism with C++: http://shop.oreilly.com/product/0636920052166.do Follow me on twitter: https://twitter.com/lefticus Source:
Html code for embedding videos on your blog
Text Comments (33)
Robin Smith (1 month ago)
CMake is a nightmare. Try porting a decent sized open source project to Visual Studio with CMake. Days of hair pulling and banging head against wall. And this video didn't help sadly.
Ezra Schroeder (3 months ago)
I'm used to managing different environments for python with conda. What do people use to quickly switch between different c/c++ compilers?
Barry Manilowa (3 months ago)
This is terrible. A waste of time. No explanation of what you're doing.
smit patil (7 months ago)
I hate people who use linux in virtualbox .they are noobs
MrToby9999 (1 month ago)
You hate noobs? Wow, how very immature!
yian dev (7 months ago)
you already lost me ccmake not even available with cmake install on window, ciao arrivederci
Animesh Gupta (6 months ago)
Thank you for posting this.!
yian dev (9 months ago)
how is that editor called?
Fataho (10 months ago)
The most complicated c++ "Hello world" I have ever seen :D Thank you for the tutorial, it was very helpful.
Pau Guillamon (11 months ago)
Great intro! I would like to see more videos about CMake, for instance how to set it up so it runs the unit tests automatically or some more advanced features (folders structure, how to deal with project related scripts needed for runtime, and so on)
Florian Wolters (1 year ago)
I think this is a lean and concise introduction to CMake. Two suggestions (already mentioned in some other comments): - Usage of target_compile_options instead of add_compile_options. The former is the modern (and non-global) way to add compiler options to a target. - Usage of target_compile_features(intro PRIVATE cxx_std_14) instead of target_compile_features. IMO this is much simpler and one does not have to modify the CMakeLists.txt file when language features are added and removed in the C++ source code. IMO future versions of the CMake application should allow abstraction of compiler flags (e.g. for error/warning reporting) via cmake-compile-features so that we do not have to specify compiler-specific flags. The real deal would be something as simple (from the users perspective) as target_compile_errors(intro PRIVATE all_errors all_warnings) (made up example).
Robin Smith (1 month ago)
Made no sense at all. CMake is overly complex crap. I suffer from high levels of stress whenever I have the unfortunate necessity to use it. Some decent documentation would help, but no. It's typical open source. Same some money but waste a heap of time trying.
Ernest Rutherford (1 year ago)
i use ninja build. cmake is terrible
Barry Manilowa (3 months ago)
yian dev You're not looking for easy. You're looking for a good tutorial and this one sucks!
yian dev (9 months ago)
any easy tutorial on how to use ninja? or its not for beginners?
Ahmed Moustafa Amin (1 year ago)
nice video, could you make a series of tutorials on cmake for beginners to excel using it, there isn't any tutorials for it on YouTube for years now. thanks
KhanRecordz (1 year ago)
Since around CMake 3.8 you can also make sure that a specific version of c++ is used by passing "cxx_std_##" where ## can be 98, 11, 14 or 17, into the target_compile_features command! :) I often feel that I either don't know the names of the features I need or don't know what features I'm using, so that feels like a nicer way to just encapsulate all of them.
Jason Turner (1 year ago)
Hmm, I thought I mentioned the cxx_std option. Maybe I'll need to do an updated episode to make sure these things are covered.
kwinzman (1 year ago)
Great, concise intro.
Kai Wolf (1 year ago)
Nice, I appreciate your use of modern CMake. There's so much old information online, we definitely need to change that:-) I'm currently in the process of writing a new book about it called 'Effective CMake' on Leanpub which exactly deals with writing effective, modern CMake. Thanks for making these videos!
Lothar Scholz (9 months ago)
Thanks, i might buy it even if i now have mastered cmake. But i still only use it for unit testing inhouse tools etc. Everything in our flagship product needs native IDE build files.
Henri de Feraudy (1 year ago)
The book called Mastering CMake has a lot of bad reviews. So I hope your book will remedy all that! One reason I want to use CMake I'm frustrated at trying to install OpenCV. The installation process via CMake does not find my Anaconda Python, thinks I only have Python 2.7 It gave me a few messages I wasnt sure I was interpreting correctly. I'm guessing that if I understood CMake correctly all that would be easier to fix.
Lectem (1 year ago)
I thought so too, until I saw add_compile_options, why not use target_compile_options ? A bit sad this was missed :/ Otherwise good intro, a big + for showing ccmake and cmake-gui that makes it way easier for people to understand cmake cache
Sakuya Izayoi (1 year ago)
Just to let you know. I am ;)
Kai Wolf (1 year ago)
Also, the link to the book just in case anyone is interested: https://leanpub.com/effective-cmake
Kevin Hjelden (1 year ago)
VS 2017 has native CMake support, so you don't even have to do that last step on windows anymore.
Aakash Mallik (4 months ago)
good lucking using it on linux
Velho Joel (7 months ago)
It's awesome you can just open up folder which contains CMake configuration and it opens up in VS as a Solution
narutofan9999 (8 months ago)
It also doesn't work very well with Resharper++.
Ybalrid (1 year ago)
I tried it and I wasn't that impressed with it. It's not really good when having to specify a lot of variable for complex dependencies, and the "open directory" features ignored the CMakeLists.txt file in one of my projects...
Jason Turner (1 year ago)
Oh snap, I should have tested that. That shall be a followup episode!
sephirostoy (1 year ago)
Visual Studio 2017 comes with a native support for CMake projects, though I didn't test it yet.
Kim (1 year ago)
Awesome! Exactly what I need!

Would you like to comment?

Join YouTube for a free account, or sign in if you are already a member.