How to CMake Good - 1b - Adding a Library

preview_player
Показать описание
Last time we created an executable, but you might also want to make some libraries! I'll show how you can make a library and how you can control what type of library is generated, as well as how we can link that library into an executable.

Addendum: I didn't touch on MODULE libraries much, only briefly mentioning them. In general, they are used to represent "plugins" for other software. It will manifest itself as a shared library but cannot be linked into other libraries. They're not as common to see.

WARNING: This video contains chemicals known to the State of California to cause cancer and birth defects or other reproductive harm.
Рекомендации по теме
Комментарии
Автор

This whole series is very helpful for beginners. Thanks a lot!

kaushikprakashrobotics
Автор

How about linking an external library?

beback_
Автор

Dude your explanations are so clear and concise.
Thank you for these wonderful videos you beautiful human! <3

theLegendOfYer
Автор

Genuinely had me laughing at the bit at the start "LOOK AT THESE HACKER SKILLZ"

bersK
Автор

When trying this example on Windows 11 with VS Code and CMake 3.22.1 using MSVC, it was necessary to add ON) before the add_library call.

Thanks for all the great videos. They really make getting into CMake alot easier.

nesavi
Автор

0:44 "Look at these HACKER SKILLS !"

王荷佑
Автор

The best, and still relevant today! Helped me get unstuck trying to learn!

ambertrongaming
Автор

What was the need of adding the header file in the add_library when we have already included it in the main.cpp? Isn't it redundant?

the-ok-stuff
Автор

Why should we put the header file into add_library()?

chenxin
Автор

hi! how would you go about managing libraries not created by oneself? I have one that I installed through homebrew and I can't make heads or tails of how to use it.

MadelynofHell
Автор

Why are you recording the whole desktop even though only the VS code matters? This makes the characters you are typing really small.

codychan
Автор

Why do you want the add library function for static libraries? If I use a set and put all the source within it it will recompile only th .src that depends on tha headers.

Megalcristo
Автор

Thank you very much for this. I learned with basic make in a class I paid for, but then find MAKE is kind of old.

BruceSchaller
Автор

0:45 Overall I like your tutorials; However I, at least, like to follow along on my own computer entering the same code and when you "fast foward so I dont have to watch" you make it very difficult for me to make the code in question. Just show making the code - If I (or anyone else) want to fast forward, we can use the arrow keys to skip it. You could tell use the time to skip, or make it a chapter. It took me a long time, stepping forward with ">" to get the code right on this.

natehill
Автор

Excellent video! This makes a lot of sense. Thank you!

bryanredd
Автор

what if i have an include in that library thats also a library

goge
Автор

What if the header file is in a different folder from the main.cpp file?

meegz
Автор

First, thanks for this video series and cmake tools. I will be using. Re libraries.... What's best practice for adding .cpp and .h files.... All in one library {} per project or separated out into per .cpp and .h? Thks

jonathanmoore
Автор

Hey, I know the support has gone to ms... Btw. Great job, vids and vscode extension... What is the best way to include header only c++ files? I've seen a lot expos on various sources... Bit they don't appear to be elegant... any thoughts?

jonathanmoore
Автор

do you need the "hello::" or can you just call say_hello? if thats a yes, what can i do to make it so that you dont need the "hello::"

charstiles