WEB Signal 412
Setting CMake environment variables in shell config automates default generators and compile_commands.json generation
CMake reads configuration values from environment variables, allowing developers to set default generators and compile_commands.json generation in their shell configuration.
This reduces repetitive command-line typing when creating new build folders and complements project-specific CMake presets. It also applies to ctest for automatically showing failing test output.
Written by elseif from the cluster below · every claim links back to a sourceThe three things worth knowing
Setting CMAKE_GENERATOR and CMAKE_EXPORT_COMPILE_COMMANDS in shell config applies these options to all new CMake build directories.
The CTEST_OUTPUT_ON_FAILURE environment variable automatically displays output for failing tests during ctest invocations.
Custom environment variables can be read directly within CMake code using the $ENV{MY_CUSTOM_FLAG} syntax.
THE CLUSTER
↗