set(CMAKE_CXX_STANDARD) adding 2 more commands, is that necessary ?

In the former, CMake knows that C++20 or newer is in effect and is performing module scanning commands. The 1/4 is a scanning command to extract import and export metadata needed for a proper build; 3/4 is the actual compile. When passing options to the compiler “behind CMake’s back” like add_compile_options does, CMake doesn’t know that modules are available and doesn’t perform the necessary steps.

1 Like