Skip to content

leimao/CMake-Examples

Repository files navigation

CMake Examples

Lei Mao

Introduction

CMake is not only a tool to make compile easier but also a Turing complete programming language. This repository contains several useful CMake examples I collected for CMake noobs including me. Instead of reading lengthy CMake documentations or randomly Googling, these examples are good start to write CMake files for your own projects.

Dependencies

  • CMake 3.10.2+
  • GNU 7.3.0+

Recommended Tools

To better program using CMake, it is recommended to use Visual Studio Code and install the following plugins.

  • C/C++
  • C++ Intellisense
  • CMake
  • CMake Tools

The following plugins are optional but also recommended in some cases.

  • vscode-cudacpp
  • vscode-icons

Examples

The following examples were included in this repositories. The instructions of each project could be found in each project directory.

This project demonstrated how to use CMake to configure a simple project to be installed in specified directories.

This project further extended the CMake usage by using libraries, subdirectories, preprocessor macros, etc.

This project described how to program control flows and some other basic operations in CMake.

This project extended HelloUnderworld v2 and talked about how the basic CMake macros changes in different scopes.

This project described function scopes and how to program basic function in CMake.

This project talked about how to use CMake to compile CUDA files.

This project extended CMakeCUDA v1 and talked about how to use CMake to compile CUDA files with ordinary C++ files.

This project extended CMakeCUDA v2 and talked about how to use CMake compile to CUDA files to library and how to use ordinary C++ files with compiled CUDA libraries.

About

CMake Examples for Noobs

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published