What is the correct way to specify C++ version building from source?

Referring to this page for how to build on WIndows 10/Vs2019: OpenCV: Installation in Windows

Using Win10, VS2019.

I want to build for C++17. The default setup wants to build for C++11.

If I just add to CMAKE_OPTIONS this:

-DCMAKE_CXX_FLAGS=-std:c++17

then cmake, in it’s printout of it’s general configuration says these somewhat contradictory things:

--     C++ standard:                11
--     C++ Compiler:                C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/14.29.30133/bin/Hostx64/x64/cl.exe  (ver 19.29.30147.0)
--     C++ flags (Release):         -std:c++17  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /MT /O2 /Ob2 /DNDEBUG
--     C++ flags (Debug):           -std:c++17  /D _CRT_SECURE_NO_DEPRECATE /D _CRT_NONSTDC_NO_DEPRECATE /D _SCL_SECURE_NO_WARNINGS /Gy /bigobj /Oi  /fp:precise     /EHa /wd4127 /wd4251 /wd4324 /wd4275 /wd4512 /wd4589 /wd4819 /MP  /MTd /Zi /Ob0 /Od /RTC1

And it saying the C++ Standard is 11, but C++flags containing -std:c++17 just makes me nervous.

Is there a “proper” way to tell cmake that when it configures for the build, to use C++17?

Nevermind. Grep fail.