Unfortunately, your variant does not work as well:
set(CMAKE_C_COMPILER_LAUNCHER env DIR=/tmp)
ExternalProject_Add(name
CONFIGURE_COMMAND cmake "-DCMAKE_C_COMPILER_LAUNCHER=${CMAKE_C_COMPILER_LAUNCHER}" ...
)
Which produces the following output:
cd ... && cmake -DCMAKE_C_COMPILER_LAUNCHER=env DIR=/tmp ...
Now I have to convert it to a string to make it work:
string(REPLACE ";" "$<SEMICOLON>" CMAKE_C_COMPILER_LAUNCHER_STR "${CMAKE_C_COMPILER_LAUNCHER}")
But this is pretty inconvenient.
PS. cmake version 3.28.3