Git Product home page Git Product logo

cpp_cmake_submodule_example's Introduction

Using CMake with Git Submodules

This repo provides a bare bones template for combining CMake with git submodules. Combining these two tools makes managing external resources very straightforward.


Overview

For this example, we will be using cpp-httplib as our external header-only resource. The file main.cpp in /src will include httplib.h and demonstrate makeing an http GET request.

The benefit of using git submodules is that we don't have to include an external project's code in our repository. Instead, we essentially create a pointer to the external repository and when a repo is cloned it downloads the submodule resources automagically.

Usage

First you will need to clone the repo. When cloning a repo with remote submodules you can grab it with the versions used in the repo using:

git clone --recurse-submodules

Or, if you want to clone the repo and update the remote submodules at the same time you would use:

git clone --recurse-submodules --remote-submodules

Finally, you can build this example like you would any other CMake based project:

foo@bar:~$ mkdir build
foo@bar:~$ cd build
foo@bar:~$ cmake ..
foo@bar:~$ make
foo@bar:~$ ./cpp_cmake_submodule_example

cpp_cmake_submodule_example's People

Contributors

ptrks avatar

Watchers

 avatar

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.