- Copy all files/directories from of
project-with-*
directory to the new directory - In
./CMakeLists.txt
change project name fromstub
to your project name - In all
*.cpp *.hpp
files change namespace fromstub
to your namespace
The dependencies are managed by conan. Before compilation:
- ensure that you have conan installed
- install all the dependencies to appropriate directories. For example if you are using CLion you will:
conan install --install-folder cmake-build-debug . --build=missing conan install --install-folder cmake-build-release . --build=missing
- Prepare
conanfile.txt
according to Conan documentation, for example:
[requires]
nlohmann_json/3.11.2
[generators]
CMakeDeps
CMakeToolchain
- Install Conan dependencies, as in example below.
These commands are also provided as a shell script
project/install_conan.sh
.
conan install . --output-folder=cmake-build-debug --build=missing --profile=debug
conan install . --output-folder=cmake-build-release --build=missing --profile=release
- In Clion
Settings -> Build, Execution, Deployment -> CMake -> CMake Options
add the following options for each profile:-DCMAKE_TOOLCHAIN_FILE=conan_toolchain.cmake
-DCMAKE_BUILD_TYPE=Release
or-DCMAKE_BUILD_TYPE=Debug