Skip to content

vainangel/CMakeLists-Template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CMakeLists-Template

A basic CMakeLists template which attempts to support AddressSanitizer with a compiler-agnostic and generator-agnostic configuration.

This is still an immature CMakeLists and more work is needed to make it sufficient for most projects. Works as a bare minimum way to successfully link with AddressSanitizer whether you're on Windows or Linux.

About

This is a composition of my research on writing a cross-platform CMakeLists which uses proper debugging information and does its best to support linkage with the AddressSanitizer library. I intend to use this in all of my important projects and will iteratively refactor and build on top of it as I see need. The template is also heavily annotated in order to explain and justify each part of the configuration.

If you notice any issues with the template, please feel free to open an issue and give your diagnostics and feedback. Please star this repo if you like this template!

NOTE to novice developers: While this CMakeLists is usable from the command line, I recommend that you know what you are doing before doing so. That being said, if you want to know how you would run these configurations from the command line, you may look
at the cmake arguments that cmake-tools for Visual Studio Code spits out when selecting certain kits and variants. If using CMake from the command line on a Linux or BSD (Mac, etc.) system, invoking cmake should be straightforward, and this cmakelists attempts to respect your development environment.

If building on Windows from command line with MSVC back-end: https://learn.microsoft.com/en-us/cpp/build/cmake-presets-vs?view=msvc-160#run-cmake-from-the-command-line-or-a-ci-pipeline

If using cmake-tools for Visual Studio Code, and you want to use an undetected build generator (like Ninja): https://github.com/microsoft/vscode-cmake-tools/blob/015abf52297c5319fb3e81b598f4b11dd82479b0/docs/cmake-presets.md

Platform Support

  • MSVC/Visual C++
  • MSVC/Clang (with ClangCL)
  • MSVC/Clang with Ninja
  • GNU/Clang for Linux
  • GNU/GCC for Linux
  • GNU/Clang for Windows (untested)
  • GNU/GCC for Windows (untested)

If you are using MSVC, AddressSanitizer can be installed through the Visual Studio installer.

TODO

  • Unit testing suite
  • Boilerplate dependency management
  • Driver and library target variants
  • Template repository configuration through GitHub
  • Multi-platform deployment testing through workflows

References

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors