How to export compile commands?

Hi clangd depends on the compile_commands.json file to work but I can’t generate it by setting the CMAKE_EXPORT_COMPILE_COMMANDS flag like below.

cmake -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=ON Slicer-SuperBuild-Debug/

I just needed to run make as well and the file was generated.