file(MAKE_DIRECTORY) is a configure-time action and does not support generator expressions. If you do file(GENERATE OUTPUT "dir/with/$<CONFIG>/.dummy" CONTENT ""), CMake will generate the directory that way (though you’ll be stuck with the .dummy placeholder files).