CMake Mastery (5): Comprehensive Guide to add_library – Static and Dynamic Libraries

CMake Mastery (5): Comprehensive Guide to add_library - Static and Dynamic Libraries

Master the Core Logic of Library Building from Compilation Principles to Industrial Practices 1. Essential Differences Between Static and Dynamic Libraries Core Feature Comparison Feature Static Library (<span>.a</span>/<span>.lib</span>) Dynamic Library (<span>.so</span>/<span>.dll</span>) Linking Method Compiled into the executable file at build time Loaded dynamically at runtime Memory Usage Multiple loads of the same library will consume … Read more

CMake: Exporting Header Files

CMake: Exporting Header Files

Introduction: In fact, the relevant content of this article has been detailed in the CMake: Detailed Explanation of Static and Dynamic Libraries (Linux/Windows) notes, where it shows that CMake provides a platform-independent way to achieve its functionality. However, the issue of symbol visibility has not been addressed. The best approach regarding symbol visibility is to … Read more