diff --git a/CMakeLists.txt b/CMakeLists.txt index bce94eb0968..c3d64e4b95d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -290,7 +290,14 @@ endif() # Global flag to set CXX standard. # This does not affect 3rd party libraries. -set(CMAKE_CXX_STANDARD 17) +# Tensorflow 2.9+ requires cxx_17, but MSVC 19.29 throws errors with C++17 +# enabled. +if (BUILD_SYCL_MODULE OR BUILD_TENSORFLOW_OPS) + set(CMAKE_CXX_STANDARD 17) +else() + set(CMAKE_CXX_STANDARD 14) +endif() +set(CMAKE_CXX_EXTENSIONS OFF) # Improved compatibility # FIXME: Remove this workaround once a fixed Visual Studio 16.10 version is released. if (BUILD_CUDA_MODULE