I am using CMake tool for windows, I am able to generate.exe but I don't know how we can generate .elf.
I tried to set the toolchain in main CMakeLists.txt and output file to .elf extension in subdirectory CMakelists.txt. check the image for more information.