{"id":18929155,"url":"https://github.com/jwillikers/sanitizer-build-types","last_synced_at":"2025-04-15T15:30:46.414Z","repository":{"id":104839144,"uuid":"243135178","full_name":"jwillikers/sanitizer-build-types","owner":"jwillikers","description":"A CMake module for adding the necessary flags for the various sanitizers.","archived":true,"fork":false,"pushed_at":"2020-02-26T17:47:11.000Z","size":17,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"develop","last_synced_at":"2025-04-06T21:52:14.314Z","etag":null,"topics":["asan","build-types","c","clang","cmake","cmake-module","cmake-modules","cpp","gcc","msan","sanitizer","sanitizers","tsan"],"latest_commit_sha":null,"homepage":"","language":"CMake","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jwillikers.png","metadata":{"files":{"readme":"README.adoc","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-02-26T00:49:58.000Z","updated_at":"2024-10-01T12:37:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"74048f7c-a2bb-4583-bec3-4b369a418264","html_url":"https://github.com/jwillikers/sanitizer-build-types","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillikers%2Fsanitizer-build-types","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillikers%2Fsanitizer-build-types/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillikers%2Fsanitizer-build-types/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jwillikers%2Fsanitizer-build-types/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jwillikers","download_url":"https://codeload.github.com/jwillikers/sanitizer-build-types/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249097775,"owners_count":21212351,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["asan","build-types","c","clang","cmake","cmake-module","cmake-modules","cpp","gcc","msan","sanitizer","sanitizers","tsan"],"created_at":"2024-11-08T11:30:34.539Z","updated_at":"2025-04-15T15:30:46.409Z","avatar_url":"https://github.com/jwillikers.png","language":"CMake","funding_links":[],"categories":[],"sub_categories":[],"readme":"= sanitizer-build-types\nJordan Williams\nifdef::env-github[]\n:tip-caption: :bulb:\n:note-caption: :information_source:\n:important-caption: :heavy_exclamation_mark:\n:caution-caption: :fire:\n:warning-caption: :warning:\nendif::[]\n\n== Summary\n\nA CMake module for adding the necessary flags for the various sanitizers.\nThe flags are added to the designated build types / configurations provided by the caller.\n\nNOTE: Only LLVM Clang and GCC are supported at this time.\nMSVC supports ASAN for 32-bit builds at the time of this writing, but this has not been implemented yet.\n\n== Configure\n\nIt is easy to incorporate this project directly at configure time by using CMake's https://cmake.org/cmake/help/latest/module/FetchContent.html[FetchContent] module.\n\n[source,cmake]\n----\ninclude(FetchContent)\nFetchContent_Declare(sanitizer-build-types GIT_REPOSITORY https://github.com/jwillikers/sanitizer-build-types GIT_TAG 0.1.0)\nFetchContent_GetProperties(sanitizer-build-types)\nif(NOT sanitizer-build-types_POPULATED)\n    FetchContent_Populate(sanitizer-build-types)\n    list(APPEND CMAKE_MODULE_PATH ${sanitizer-build-types_SOURCE_DIR}/cmake/modules)\nendif()\n----\n\n== Usage\n\nTo use, just include the `SanitizerBuildTypes` module, and call the `sanitizer_build_types` function as follows.\n[source,cmake]\n----\ninclude(SanitizerBuildTypes)\nsanitizer_build_types(ASAN AddressSanitizer LSAN LeakSanitizer MSAN MemorySanitizer TSAN ThreadSanitizer UBSAN UndefinedBehaviorSanitizer)\n----\n\nThe only arguments required are the names of the configurations.\nIn the previous example, the build type `AddressSanitizer` has been configured as a debug build and given the necessary compile and link flags to enable the Address Sanitizer. \nFor a single-configuration generator, this build type can be enabled from the build directory like so:\n\n[source,cmake]\n----\ncmake -DCMAKE_BUILD_TYPE=AddressSanitizer ..\n----\n\nFor multi-configuration generators, use the `--config` flag in conjunction with the `--build` flag to designate the build configuration.\n\n[source,cmake]\n----\ncmake --build .. --config AddressSanitizer\n----\n\nNOTE: It is not necessary to define build types for _all_ 5 sanitizers.\nFeel free to omit those you don't want.\n\n== License\n\nThis project is licensed under the link:./LICENSE[Apache 2.0 License].\n\n== Authors\n\nhttps://github.com/jwillikers[{author}]\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwillikers%2Fsanitizer-build-types","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjwillikers%2Fsanitizer-build-types","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjwillikers%2Fsanitizer-build-types/lists"}