Code Monkey home page Code Monkey logo

cmake_cookbook's Introduction

CMake Cookbook

This is a collection of subprojects showing various advanced facets of CMake. It started out as a personal tool-evaluation repository for graphic and networking libraries, and shows some of the ways I use CMake.

The "source" files being compiled in these examples are taken directly from the project being shown. Only CMake is on display here.

If you've never used CMake before, please see A Brief Beginner's Guide to CMake, which served as inspiration for releasing this repository.

Use

Each project has a README detailing sub-requirements, showing the project layout, and walking through the CMakeLists.txt files.

Generally to build each, the following usage is encouraged:

$ mkdir build
$ cd build
$ cmake ..
$ <build system invocation, usually 'make'>

This is what's known as an "out-of-source" build, and it is strongly encouraged with CMake. There are a few major advantages in CMake:

  • There will be a LOT of files generated, and it's easier to have a build/* directive in your SCM ignore file, versus manually cleaning out after a build.
  • when creating/debugging a CMakeLists.txt file, it's easy to remove the directory and not have to worry about any lingering CMake variables hiding in CMakeCache.txt or other locations. Subsequent cmake/make calls will NOT remove variables you might have set in previous versions of your CMakeLists.txt!
  • it's easy to search through the directory to find out what a 3rd-party library is trying to do while debugging a CMakeLists.txt file

Don't forget there are many ways of running CMake beyond the standard CLI invocation! See the official Running CMake page for more.

Tested Platforms

  • OpenBSD 6.2
  • OSX 10.11 w/ Macports 2.4.2
  • Debian stretch

There should be no issues with running these examples on Windows, but no testing has been performed due to lack of access to a Windows system.

Requirements:

Linux:

  • build-essential
  • git
  • cmake
  • pkg-config

OSX/BSD:

  • git
  • cmake
  • pkg-config

Licensing

The base CMakeLists.txt and README.md files in each directory were created for the cmake_cookbook project, and are covered under the terms of the MIT License detailed in the LICENSE file.

The CMakeLists.txt files in nanovg/libs/nanovg/ and imgui/libs/imgui were also created for the cmake_cookbook, and are also covered under the MIT License.

Code samples in the src/ directories are taken from the projects being shown and should be considered to be under the license for that specific project.

In the interest of having a working example for nanovg, the nanovg/media directory contains a copy of the "NotoSansUI-Regular.ttf" file from Google's Noto fonts collection , licensed under SIL OFL 1.1.

cmake_cookbook's People

Contributors

mechazoidal avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

nonlinear1

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.