-
Book Overview & Buying
-
Table Of Contents
-
Feedback & Rating
Minimal CMake
By :
In addition to static and shared libraries, there is another well-known library type often referred to as header-only. A header-only library provides all its implementation directly in its headers (.h files). It is not compiled or linked ahead of time, the .h files are simply included and then compiled with the source of the main application.
Header-only libraries are popular because of their ease of integration (you can include the .h file in your project and things will usually just work). The downside is that you pay a cost by compiling that library whenever you change your code, which, depending on the complexity of the library, can add a lot of overhead. Header-only libraries tend to be popular in C++ with template libraries, which require their implementation to be present in the header file itself.
Fortunately, CMake offers a straightforward way to create header-only libraries that can be used like any other library. A complete header-only CMakeLists...