NVHPC: nvc++-Error-Unknown switch: -Minfo=all
Currently CMake emits the --c++17
compiler option when CMAKE_CXX_STANDARD
is set to 17
with the NVHPC compiler instead of -std=c++17
.
As far as I can tell from the nvc++
manual, these two options are equivalent and interchangeable (I could be wrong). The problem is that using --c++17
appears to prevent the compiler from recognizing certain switches such as -Minfo=all
. The error I see is nvc++-Error-Unknown switch: -Minfo=all
.
In the attached files you will find a bare bones CMake project along with the verbose output from setting --c++17
and -std=c++17
directly through target_compile_options
.
It seems to me that the simple fix is to emit -std=c++17
instead of --c++17
when CMAKE_CXX_STANDARD
is set to 17
, assuming that there is no particular reason why --c++17
was chosen over -std=c++17
. If there is in fact a particular reason, then at least --c++17
should not prevent the switches from being unrecognized.
Both --c++17
and -std=c++17
result in no warnings when used outside of CMake, which is why I believe this is an issue with the NVHPC CMake integration.