Skip to content

Releases: StableCoder/cmake-scripts

25.08 - August 2025

05 Aug 00:38
5b6c6ef
Compare
Choose a tag to compare

Full Changelog: 24.08.1...25.08

Code Coverage Rework

The code coverage via clang/LLVM and GCC/lcov has been largely updated.

Additional EXCLUDE options

The EXCLUDE options when passed to either target_code_coverage or add_code_coverage_all_targets applies to both backends. While this is fine for specified files, when attempting to deal with non-specifics, such as attempting to exclude directories, the two back-ends accept different input. GCC/lcov excludes via glob, and clang/LLVM excludes by regex.

As such, the LLVM_EXCLUDE and LCOV_EXCLUDE options have been added so projects that use both can do so with less issues.

target_code_coverage(
  example
  EXCLUDE file/path.cpp
  LLVM_EXCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/.*
  LCOV_EXCLUDE ${CMAKE_CURRENT_SOURCE_DIR}/*
  )

Fixed parrallelization of clang/LLVM coverage builds

Previously to accomodate the ccov-all targets, a file would be written to that would contain all objects to check against and all generated profile data files, and because multiple execution runs could attempt to write to the same file without locking, issues/corruption could occur.

To resolve, each individual target now places that data into separate files in an expected location, and the ccov-all targets now collate all those files instead, mitigating the issue.

Updated Sanitizer Examples

More examples to more comprehensively show the issues that can be detected.

Added baseline CI jobs to show how the examples can run without obvious issue when not instrumented.

Cleanup Warnings

With the release of CMake 4.0, some add_custom_command calls had empty COMMANDs which are no longer allowed by default.

24.08.1 - August 2024

25 Aug 05:10
95f2126
Compare
Choose a tag to compare

Full Changelog: 24.04.1...24.08

Sanitizer Scripts Rework

How sanitizers work has been completely changed internally.

Sanitizers and their options are now declared via calling the set_sanitizer_options() function, and applying sanitizers to be used is via the new add_sanitizer_support() call.

Whether sanitizers are available/supported is no longer a function of the script inferring via the compiler/platform, but instead by checking whether the flags are available on the compiler no matter the platform.

DEPRECATED

The ability to use sanitizers via the global USE_SANITIZER variable is now deprecated and will be removed in a future release.

To maintain the same behaviour after removal, add this to CMake scripts file after including the sanitizers file:

if(NOT MSVC)
    set(SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS -fno-omit-frame-pointer)
endif()

set_sanitizer_options(address DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(leak DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(memory DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(memorywithorigins DEFAULT SANITIZER memory
    -fsanitize-memory-track-origins ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(undefined DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(thread DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})
set_sanitizer_options(cfi DEFAULT ${SANITIZER_LEGACY_DEFAULT_COMMON_OPTIONS})

set(USE_SANITIZER
      ""
      CACHE
        STRING
        "Compile with sanitizers. Available sanitizers are: ${SANITIZERS_AVAILABLE_LIST}"
)

if(USE_SANITIZER)
  add_sanitizer_support(${USE_SANITIZER})
endif()

24.04.1 - April 2024 (Hotfix)

23 Apr 00:59
24.04.1
45f72fd
Compare
Choose a tag to compare

Accidentally broke LLVM-based code coverage when linking objects in.

Full Changelog: 24.04...24.04.1

24.04 - April 2024

12 Apr 22:57
Compare
Choose a tag to compare

Full Changelog: 23.09...24.04

  • Set the prepare-catch.cmake as deprecated, since modern Catch has solid CMake scripts and integration already.
  • The OBJECTS set for code coverage now also adds static libraries in addition to the original shared libraries when displaying coverage information.

23.09 - September 2023

26 Sep 01:47
Compare
Choose a tag to compare
  • Fix ccov-all-export on Windows platform with an if/else split.
  • Add C support for clang-tidy, iwyu and cppcheck
  • Mark detail C/C++ tool variables as advanced to not clutter normal output with implementation details
  • Rework of tools.cmake items. The options of CLANG_TIDY, IWYU and CPPCHECK have been removed. Instead, it is up to the including project on when/how to enable these tools. The ability to 'reset' the tools, to disable them for certain scopes has been accommodated via the use of reset_* macros.

To remake the exact behaviour from before for tools.cmake, you can change something like this:

clang_tidy(...)
include_what_you_use(...)
cppcheck(...)

to

option(CLANG_TIDY "Turns on clang-tidy processing if it is found." OFF)
if(CLANG_TIDY)
  clang_tidy(...)
endif()

option(IWYU "Turns on include-what-you-use processing if it is found." OFF)
if(IWYU)
  include_what_you_use(...)
endif()

option(CPPCHECK "Turns on cppcheck processing if it is found." OFF)
if(CPPCHECK)
  cppcheck(...)
endif()

23.06 - June 2023

12 Jun 18:35
Compare
Choose a tag to compare

Fixed code coverage support on Windows for the ccov-all-export target, thanks to @stanczyk4 via #45.

23.04 - March 2023

25 Apr 04:32
Compare
Choose a tag to compare

What's Changed

  • Add plain option for target coverage by @rlalik in #36
  • Fix setting of cache variables by @rlalik in #38
  • code-coverage.cmake: do not inline when determining code coverage by @FreddyFunk in #40
  • Fix llvm toolchain used for code coverage when using AppleClang on macOS
  • Remove all Find*.cmake module files. All the covered libraries now have proper pkg/CMake config files installed with them.
  • Add CMAKE_CROSSCOMPILING_EMULATOR to code-coverage. When cross-compiling, the used emulator will be prefixed to the call.
  • Remove ccov-preprocessing target

New Contributors

Full Changelog: 22.01...23.04

22.01 - Janurary 2022

24 Jan 02:11
Compare
Choose a tag to compare

Some fixes, some new features.

  • Implemented Link-Time Optimization (Ineffective on GCC) (link-time-optimization.cmake)
  • Better code-coverage usability on Windows (code-coverage.cmake)
  • Fixed code coverage ccov-all targets when using CMake pre-3.17 (code-coverage.cmake)
  • Fixed code-coverage ccov-all targets on Windows (code-coverage.cmake)
  • Added standard C++23 function (c++-standards.cmake)
  • Added macros for C-standards from C90 to C23 (c-standards.cmake)
  • New per-target export option (code-coverage.cmake)
  • Remove double-running of code-coverage targets (code-coverage.cmake)
  • Can now combine multiple sanitizers in one build (sanitizers.cmake)
  • Add new Control Flow sanitizer optin (sanitizers.cmake)
  • Add ability to make AFL++ (american fuzzy lop) fuzz instrumented builds (afl-fuzzing.cmake)

21.01 - January 2021

04 Jan 22:01
Compare
Choose a tag to compare

Changes from November 2020 -> January 2021

  • Added new script that can build GLSL shader source files can be linked to a specified target and compiled for, complete with only re compiling only files modified since last compilation.
  • Added files that allow for using the find_package function in CMake to find various libraries not included with CMake: fmt, assimp, glm, OpenXR and yaml-cpp.

20.11 - November 2020

15 Nov 17:33
Compare
Choose a tag to compare

Changes from April -> November 2020

  • Changes primary branch from 'master' to 'main', including README links
  • Fixed shared code not showing on ccov-all reports (with clang)
  • Catch2 no longer uses 'master' as the default branch, as CMake tries to use. As such, the specific tag 'v2.x' is to be used, which safely follows Catch2's releases.