CMake Integration¶
Build Options¶
These options control how mu::tiny itself is built. Pass
-D<OPTION>=<value> on the command
line or configure them in a
CMake presets file.
- MUTINY_USE_STD_CPP_LIB¶
Boolean, default
ON. Build mu::tiny with the C++ standard library. Set toOFFfor bare-metal or freestanding targets where no<std>headers are available.
- MUTINY_USE_STD_STRING¶
Boolean, default
ON. Usestd::stringinternally instead of mu::tiny’s ownStringclass. RequiresMUTINY_USE_STD_CPP_LIB.
- MUTINY_EXAMPLES¶
Boolean. Build the example programs under
examples/. Defaults toONwhen mu::tiny is the top-level CMake project,OFFwhen consumed viaFetchContentoradd_subdirectory().
- MUTINY_BUILD_TESTING¶
Boolean. Build mu::tiny’s own test suite. Defaults to
ONat the top level,OFFwhen consumed. Relevant only for mu::tiny developers.
Package Variables¶
These variables are set by find_package(mutiny)
and are available to consuming projects immediately after that call.
- MUTINY_MODULE_PATH¶
Path to the directory containing
Mutiny.cmake.find_package(mutiny)also appends this directory toCMAKE_MODULE_PATHso thatinclude(mutiny)works without any extra setup.
CTest Integration Module¶
Provides CTest integration for the mutiny unit-testing framework.
include(mu.tiny)
After including this module the mutiny_discover_tests() command is
available. It attaches a post-build step to a test executable that enumerates
its tests and registers each one as an individual CTest test, giving
fine-grained pass/fail reporting without requiring a CMake re-run when tests
are added or removed.
Cache Variables¶
The following cache variables control default behaviour globally. Each may
be overridden per target through the matching keyword argument of
mutiny_discover_tests().
- MUTINY_TESTS_DETAILED¶
Boolean option. When
ON, each discovered test case is run as its own CTest invocation instead of sharing a single test-executable run. Default:OFF.
- MUTINY_JUNIT_REPORT¶
Boolean option. When
ON, each discovered test invocation receives a unique-pjunit=<target>.<group>argument so the executable emits a JUnit-format XML report named<target>.<group>.xmlin the test’s working directory. One file is produced per CTest test, avoiding collisions when tests run in parallel. Default:OFF.
Commands¶
- mutiny_discover_tests¶
Automatically register CTest tests by querying the compiled test executable:
mutiny_discover_tests(target [DETAILED <bool>] [EXTRA_ARGS <arg>...])
mutiny_discover_tests()adds a post-build command on target that runs the executable to list its test groups and names, then writes a generated.cmakefile. CTest includes that file at test time to register each case individually. The function is a no-op whenBUILD_TESTINGisOFF.targetName of an executable target built by the current project. A
FATAL_ERRORis raised if the target does not exist or is not an executable.DETAILED <bool>Override
MUTINY_TESTS_DETAILEDfor this target.EXTRA_ARGS <arg>...Override
MUTINY_EXTRA_ARGSfor this target.
Cross-compilation: when
CMAKE_CROSSCOMPILINGis set, the target must have aCROSSCOMPILING_EMULATORdefined; if absent, discovery is skipped with a warning.