CMake passing -std:c++17 to MSVC instead of /std:c++17, apparently causing it not to pick up 17 features
Cmake is passing the flag using a dash, instead of /. Most other flags passed to the compiler are using forward slashes. I'm guessing this is the problem?
[3/55] Building CXX object extern\tuvok\tests\CMakeFiles\test_tuvok.dir\test_monitors.cpp.obj
FAILED: extern/tuvok/tests/CMakeFiles/test_tuvok.dir/test_monitors.cpp.obj
C:\PROGRA~2\MICROS~4\2019\BUILDT~1\VC\Tools\MSVC\1421~1.277\bin\Hostx64\x64\cl.exe /nologo /TP -DFMT_LOCALE -I..\..\extern\tuvok\include -I..\..\extern\vulkanheaders\include -I..\..\extern\catch\single_include -I..\..\extern\nlohmann_json\single_include -I..\..\extern\fmt\include -Ilib\glfw\include /DWIN32 /D_WINDOWS /GR /EHsc /Zi /Ob0 /Od /RTC1 -std:c++17 /showIncludes /Foextern\tuvok\tests\CMakeFiles\test_tuvok.dir\test_monitors.cpp.obj /Fdextern\tuvok\tests\CMakeFiles\test_tuvok.dir\ /FS -c ..\..\extern\tuvok\tests\test_monitors.cpp
..\..\extern\tuvok\tests\test_monitors.cpp(30): error C2061: syntax error: identifier 'filesystem'
I have tried all combinations of CMAKE_CXX_STANDARD, target_compile_features
set_property(TARGET my_target PROPERTY CXX_STANDARD 17)
set_property(TARGET my_target PROPERTY CXX_STANDARD_REQUIRED
etc etc. etc.
This is killing Intellisense's ability to pick up C++17 headers, as well as killing compilation.
For now, as a workaround, I'm manually doing: target_compile_options(test_tuvok PRIVATE "/std:c++l7")
and that fixes it. But I feel dirty :(.
Edited by Brad King