Clean C++ project for you to use. Features: Modern CMake, CPack, Doxygen, PlantUML, Catch Unit testing, static analysis
This is an empty frame for project in C++. It should help to start a new project without caring much about project/build environment setup.
external/CMakeLists.txt
and cmake/cleanCppExtension.cmake
\todo see how todo works
git clone https://github.com/kracejic/cleanCppProject.git yourNewProject
cd yourNewProject
mv .git .git-cleanCppProject
git init
git add .
git commit -m "first commit"
More in How to start working.
We are improving this repo on a regular basis, if you want to get more from us, try to pull the main repo.
cd yourNewProject/
git pull --git-dir='.git-cleanCppProject'
Arch Linux: sudo pacman -S cmake g++ graphviz git clang clang-tools-extra cppcheck java-runtime-common cppcheck
Ubuntu 16.04: sudo apt-get install cmake g++ graphviz plantuml git clang clang-tidy clang-format cppcheck
Two ways, which were tested:
msys2 based
pacman -S cmake g++ git
pacman -S clang mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-clang-analyzer doxygen
c:\Program Files\Graphviz
, so scripts can find it) and add its bin
subdirectory to PATH, install java (have its bin directory on PATH), download PlantUML jar file and have it on PATH.Microsoft Visual Studio
brew install llvm doxygen cppcheck graphviz
Standard Makefiles:
mkdir build ; cd build
cmake ..
make -j8
Ninja build witch clang, build all+doc and install it to dist folder:
mkdir build ; cd build
cmake -GNinja -DCMAKE_CXX_COMPILER="clang++" ..
ninja all doc install
Release build which will install itself into /usr
after sudo make install
mkdir build ; cd build
cmake .. -DCMAKE_INSTALL_PREFIX="/usr" -DCMAKE_BUILD_TYPE="Release"
make -j8 all
sudo make install
On windows you should prefer Ninja since it is much faster than make (but has no color in shell).
With gcc:
mkdir build ; cd build
cmake -GNinja ..
ninja install
You can use cmake -G "MSYS Makefiles" ..
if you want to use make.
First you may wan to change project name in main CMakeLists.txt
. Just go to the folder with the project and create new directory and create project files with this:
mkdir buildmsvc
cd buildmsvc
cmake -G "Visual Studio 14 2015" ..
and you can now open a .sln
file with Visual Studio. You need to right click on executable target and Set as StartUp project. To really see the console window you want to do Start without debugging, since when run in debug mode only, console widow is closed too fast.
Note: Availability of some targets depends on availability certain executables (e.g. clang-format for format target)
build_dir/doc/doc/index.html
doc/CMakeLists.txt
-DCMAKE_INSTALL_PREFIX
- location for installation-DVERSION_HOST
- build machine name, see version.h.in-DCMAKE_BUILD_TYPE
- for build type-DMEASURE_ALL=ON/OFF
- Measure time of all compilations, best used with single threaded build. Needs time
command (unix).-DUSE_GOLD_LINKER=ON/OFF
- whether to link with Gold linker.Copyright (c) 2019 Kracejic
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.