![]() ![]() Simply remove the standalone / documentation directory and according github workflow file.Ĭan I build the standalone and tests at the same time? / How can I tell my IDE about all subprojects? I don't need a standalone target / documentation. See here for an example header-only library based on the template. Yes, however you will need to change the library type to an INTERFACE library as documented in the CMakeLists.txt. FAQĬan I use this for header-only libraries? CcacheĬcache can be enabled by configuring with -DUSE_CCACHE=. Additional arguments can be passed to the analyzers by setting the CLANG_TIDY_ARGS, IWYU_ARGS or CPPCHECK_ARGS variables. By default, analyzers will automatically find configuration files such as. Static Analyzers can be enabled by setting -DUSE_STATIC_ANALYZER=, or a combination of those in quotation marks, separated by semicolons. Sanitizers can be enabled by configuring CMake with ‘-DUSE_SANITIZER=`. The test and standalone subprojects include the tools.cmake file which is used to import additional tools on-demand through CMake configuration arguments. cmake -S all -B buildĬmake -build build -target GenerateDocs Additional tools This is useful during development, as it exposes all subprojects to your IDE and avoids redundant builds of the library. The project also includes an all directory that allows building all targets at the same time. To build the documentation locally, you will need Doxygen, jinja2 and Pygments installed on your system. cmake -S documentation -B build/docĬmake -build build/doc -target GenerateDocs To manually build documentation, call the following command. The documentation is automatically built and published whenever a GitHub Release is created. pip install clang-format = 14.0.6 cmake_format = 0.6.11 pyyaml Build the documentation These dependencies can be easily installed using pip. cmake -S test -B build/testĬmake -build build/test -target fix-format This requires clang-format, cmake-format and pyyaml to be installed on the current system. Use the following commands from the project's root directory to check and fix C++ and CMake source style. To collect code coverage information, run CMake with the -DENABLE_TEST_COVERAGE=1 option. cmake -S test -B build/testĬTEST_OUTPUT_ON_FAILURE = 1 cmake -build build/test -target test # or simply call the executable: ![]() Use the following commands from the project's root directory to run the test suite. ![]() build/standalone/Greeter -help Build and run test suite Use the following command to build and run the executable target. During development it is usually convenient to build all subprojects at once. To cleanly separate the library and subproject code, the outer CMakeList.txt only defines the library itself while the tests and other subprojects are self-contained in their own directories. Feel free to replace the License with one suited for your project. Add your project's codecov token to your project's github secrets under CODECOV_TOKENĮventually, you can remove any unused files, such as the standalone directory or irrelevant github workflows for your project.For header-only libraries: see the comments in CMakeLists.txt.Remember to rename the include/greeter directory to use your project's lowercase name and update all relevant #includes accordingly.Capitalization matters here: Greeter means the name of the project, while greeter is used in file names.Replace all occurrences of "Greeter" in the relevant CMakeLists.txt with the name of your project.Automatic documentation and deployment with Doxygen and GitHub Pages.Installable target with automatic versioning information and header generation via PackageProject.cmake.Reproducible dependency management via CPM.cmake.Code formatting enforced by clang-format and cmake-format via Format.cmake.Continuous integration via GitHub Actions.Clean separation of library and executable code.Suited for single header libraries and projects of any scale.This template is the result of learnings from many previous projects and should help reduce the work required to setup up a modern C++ project. Setting up a new C++ project usually requires a significant amount of preparation and boilerplate code, even more so for modern C++ projects with tests, executables and continuous integration. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |