Adding Libraries
Introduction
CMake
makes it easy to link libraries to your project. Libraries can be system libraries, third-party libraries, or libraries you build yourself.
Key Concepts
find_package()
: Finds a system library or package.add_library()
: Creates a library target.target_link_libraries()
: Links libraries to a target.
Code Sample
You can continue using the files from the previous chapter.
- Create a new file
my_library.cpp
with some dummy code.
- Edit the
CMakeLists.txt