Looking for a clean workaround to define environment variable during build step.

Hi, I’d like to set some environment variables that is needed during build step. I know it’s currently not supported in build step, but only in configuration step

set(ENV{myVar} value) 

Perhaps is there any alternative to define such variable in build step except for using external script that will set the variable prior to call the cmake for build step.

There’s no way to do this generically, no. cmake --build could, perhaps, do something, but there’s nothing to be done for anyone running ninja or other build tools directly. Because of that, I don’t think cmake --build should add such functionality since it would mean it’d become the only way to actually build an arbitrary CMake project.