To use our C++ library in a CMake project, you only need to include this file and to reference our library with the yoctolib name. To add a library in CMake, use the addlibrary() command and specify which source files should make up the library. This file contains all the compilation rules for our library. CMake Use GLOB to generate filelist for install package Patrik Lehmann patrik.lehmann at Thu Aug 11 05:03. Rather than placing all of the source files. Moreover, CMake is open source and is available on almost all platforms.įor these reasons, since version 0 of our C++ library, we added a CMakeLists.txt file in the Sources subdirectory. To add a library in CMake, use the addlibrary() command and specify which source files should make up the library. As we are going to see below, the CMake syntax is much simpler, making the life of the developer easier as well. cpp file into an executable, but its syntax is very complex and becomes almost incomprehensible for large projects. Indeed, GNU make already enables us to describe the commands to be run to transform a. We could wonder why not using GNU make directly. Usually under Linux, one uses CMake to generate a GNU make file which then uses gcc or g++ to compile the source file and to create the executable.ĬMake generates makefiles which enable you to compile the application with gccĪ CMake project is composed of source files and of one or several CMakeLists.txt files containing the required information to compile the application, such as the location of the source files, the name of the executable, the libraries to be used, and so on. In other words, the role of CMake is not to actually build the executable, but to prepare a list of commands to be performed to generate the executable. CMake is neither a compiler nor an IDE, but it is a "tool for managing the build process of software". If it is not the case, we recommend that you start by reading our post " How to start in C++ with Yoctopuce modules" which explains how our library works.įirst of all, a few words on CMake. addlibrary ( STATIC SHARED MODULE EXCLUDEFROMALL
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |