Skip to content

xiongmingzhi/cmake-project-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMake C Project Template

Thank you for your interest in this project!

Are you just starting with CMake or C ?

Do you need some easy-to-use starting point, but one that has the basic moving parts you are likely going to need on any medium sized project?

This project refers to muduo(https://github.com/chenshuo/muduo) project and cmake-project-template(https://github.com/kigster/cmake-project-template)

It is a minimal project that's kept deliberately very small. When you build it using CMake/make (see below) it generates:

  1. A tinycmake demo
  2. A command line binary bin/divider,using cmake-project-template(https://github.com/kigster/cmake-project-template).
  3. An executable spdlog bin/divider_tests using spdlog (https://github.com/gabime/spdlog).
  4. An optional BASH build script using muduo CmakeList (https://github.com/chenshuo/muduo).

Prerequisites

You will need:

  • A modern C/C compiler
  • CMake 3.1.4 installed (on a Mac, run brew install cmake)
  • If you prefer to code in a great IDE, I highly recommend Jetbrains CLion. It is fully compatible with this project.

Building The Project

Git Clone

First we need to check out the git repo:

❯ mkdir ~/workspace
❯ cd ~/workspace
❯ git clone \
    https://github.com/xiongmingzhi/cmake-project-template \
    my-project
❯ cd my-project
❯ bash build-and-run

Building Manually

❯ rm -rf build && mkdir build
❯ git submodule init && git submodule update
❯ cd build
❯ cmake ..
❯ make && make install
❯ cd ..

Building in CLion

NOTE: Since JetBrains software does not officially support git submodules, you must run git submodule init && git submodule update before starting CLion on a freshly checked-out repo.

NOTE: We recommend that you copy file .idea/workspace.xml.example into .idea/workspace.xml before starting CLion. It will provide a good starting point for your project's workspace.

Assuming you've done the above two steps, you can start CLion, and open the project's top level folder. CLion should automatically detect the top level CMakeLists.txt file and provide you with the full set of build targets.

License

© 2022-2029 xzy.

Open sourced under MIT license, the terms of which can be read here — MIT License.

Acknowledgements

This project is a derivative of the CMake Tutorial, and is aimed at saving time for starting new projects in C that use CMake and GoogleTest.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages