repository branch) and CMake will automatically download and optionally build that project for you. Its usage is straightforward – you have to specify Git/SVN/file/other location and optional parameters (e.g. CMake has two integrated mechanisms for supporting that:īoth commands are almost identical except for one crucial difference: FetchContent is launched during the generation time (when you call cmake) and ExternalProject_Add is launched during build time (e.g. Internet) or simply from another local repository/disk directory. In some cases we are forced to use some external projects from the remote location (e.g. CMake allows easy external project download and incorporation However, this is not a good practice because it makes our build system tightly coupled with the concrete platform (which is in contrary to the purpose of CMake). CMake supports native shell commands/apps executionĭespite being OS-independent, CMake still gives you ability to execute custom host-specific shell commands or launch given application with the following commands: Only by using different command line option you can target either MacOS XCode or Windows Visual Studio. List of available options is dependent on the build host, which is natural (usually there is no need to generate Visual Studio projects on Linux).īelow you can find a complete list (as for publication date) of all supported frameworks (CMake is calling them generators): CMake supports multiple IDE’s and build frameworksĬMake is a build system generator (meta build system), which means that it creates configuration files for other existing build systems. Of course case when host and target is the same is assumed by default. There is a clear separation between build host and build target. Note, that I say “build on”, not “build for”. No need to write Makefiles, configure Visual Studio projects, create custom Bash or batch files. It means, that we can build projects which use CMake on all above platforms without additional platform-specific configurations. Currently it can run on all major platforms: This one should be obvious since CMake has been cross-platform from the beginning. Consult the official CMake docs for more details. This article aims to give a brief overview of CMake capabilities without going deep into technical details. After all, who would like to invest in studying new features and best practices of a build system?! Well I do, and let me share with you 19 reasons, why CMake is actually awesome and you should give it a try again. The only problem is that once a bad impression was made, it is really hard to change it. Almost all cons are gone in favor of the new modern solutions. Syntax was a bit oldish and managing the compilation flags usually lead to headaches.īut since CMake 3.x (released on 06.2014) we have way more flexible and elegant ways of creating build systems with CMake. Before CMake 3.x (aka Modern CMake) we were forced to use include_directories() or manually set installation paths for libraries, that were not supported by default in CMake. Expressing public hate for CMake has become a way of integrating with other software developers on the Internet.Īnd I partially understand that statements. People say that it is hard to properly set the include paths, that syntax is archaic or that managing dependencies is a nightmare. Topic of CMake is extremely controversial in the C/C++ community.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |