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:
- A tinycmake demo
- A command line binary
bin/divider
,using cmake-project-template(https://github.com/kigster/cmake-project-template). - An executable spdlog
bin/divider_tests
using spdlog (https://github.com/gabime/spdlog). - An optional BASH build script using muduo CmakeList (https://github.com/chenshuo/muduo).
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.
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
❯ rm -rf build && mkdir build
❯ git submodule init && git submodule update
❯ cd build
❯ cmake ..
❯ make && make install
❯ cd ..
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.
© 2022-2029 xzy.
Open sourced under MIT license, the terms of which can be read here — MIT License.
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.