Template set up with basic infrastructure for C++ projects.
Necessary build tools are:
- CMake 3.27 or higher
- Conan 2.0 or higher
- One of supported compilers:
- Clang-17
- GCC-13
- Visual Studio 2022 (MSVC v193)
conan install . --profile=conan/clang-17 --build=missing --settings build_type=Release
- Conan profiles for supported compilers:
gcc-13
,clang-17
andmsvc-2022
- Conan build types:
Release
,Debug
cmake --preset release
cmake --build --preset=release
Disable building of tests by:
- Adding
--conf tools.build:skip_test=True
toconan install
command - Adding
-DBUILD_TESTING=OFF
during CMake configure
Building of tests is enabled by default. Execute the tests with the following command:
ctest --preset release
Use the preset matching the build type used when installing dependencies.
When compiling with MSVC
or using some other multi configuration generator use
multi-debug
or multi-release
presets.
Enable running clang-format
automatically on all source files during build by
adding -DAFV_ENABLE_CLANG_FORMAT=ON
during CMake configure. This option is
disabled by default.
Enable toolchain security hardening compiler options, by adding an additional
profile to the conan install
command, together with --build=*
to recompile
dependencies with hardening enabled. The hardening options should only be used
with Release
build type. This option is disabled by default.
conan install . --profile=conan/clang-17 --profile=conan/opt/linux-hardening --build=* --settings build_type=Release
- Conan profiles for toolchain hardening are:
linux-hardening
andmsvc-hardening
Enable sanitizers by adding an additional profile to the conan install
command,
together with --build=*
to recompile dependencies with santizers enabled. Sanitizers
should only be used with Release
build type. These options are disabled by default.
conan install . --profile=conan/clang-17 --profile=conan/opt/linux-address-sanitizer --build=* --settings build_type=Release
- Conan profiles for
Clang
andGCC
sanitizers are:linux-address-sanitizer
,linux-leak-sanitizer
,linux-thread-sanitizer
,linux-undefined-sanitizer
- Thread sanitizer cannot be used in combination with any other sanitizer
- Conan profile for
MSVC
compiler is:msvc-address-sanitizer
- Run the compiled executables from the developer command prompt, or execute
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64
to correctly set up search paths for runtime libraries
- Run the compiled executables from the developer command prompt, or execute
Enable running clang-tidy
automatically on all source files during build by
adding -DAFV_ENABLE_CLANG_TIDY=ON
during CMake configure. This option is
disabled by default.
Enable compiler flags for static analysis during build by adding -DAFV_ENABLE_COMPILER_STATIC_ANALYSIS=ON
during CMake configure. This option is disabled by default.
- Compiler static analysis is supported for
GCC
andMSVC
compilers
Enable running of include-what-you-use
automatically on all source files during
build by adding -DAFV_ENABLE_IWYU=ON
during CMake configure. This option is
disabled by default.
Enable running of cppcheck
automatically on all source files during build by
adding -DAFV_ENABLE_CPPCHECK=ON
during CMake configure. This option is disabled
by default.