@@ -243,6 +243,13 @@ endif()
243243if (MSVC )
244244 set_c_cxx_flag("/MP" )
245245
246+ # There is no flag for standards before C++17
247+ if (USE_CPP23 AND USE_RECOMMENDED_CXX_STANDARD)
248+ set_cxx_flag("/std:c++23preview" )
249+ else ()
250+ message (FATAL_ERROR "WIENIEONOIENOINIEN" )
251+ endif ()
252+
246253 if (USE_FAST_MATH)
247254 set_c_cxx_flag("/fp:fast" )
248255 else ()
@@ -319,26 +326,21 @@ else()
319326 endif ()
320327 endif ()
321328
322- if (USE_CPP23)
323- if (MSVC )
324- add_compile_options ("/std:c++23preview" )
325- else ()
329+ if (USE_RECOMMENDED_CXX_STANDARD)
330+ if (USE_CPP23)
326331 try_cxx_flag(GNUXX23 "-std=gnu++23" )
327-
328332 if (NOT FLAG_GNUXX23)
329- message (WARNING "Requested C ++23 is not supported, falling back to C++14 " )
333+ message (FATAL_ERROR "GNU ++23 is not supported by the compiler " )
330334 endif ()
331- endif ()
332- endif ()
333-
334- if (NOT USE_CPP23 AND (NOT FLAG_GNUXX23 OR USE_RECOMMENDED_CXX_STANDARD))
335- # PNaCl only defines isascii if __STRICT_ANSI__ is not defined,
336- # always prefer GNU dialect.
337- try_cxx_flag(GNUXX14 "-std=gnu++14" )
338- if (NOT FLAG_GNUXX14)
339- try_cxx_flag(GNUXX1Y "-std=gnu++1y" )
340- if (NOT FLAG_GNUXX1Y)
341- message (FATAL_ERROR "GNU++14 is not supported by the compiler" )
335+ else ()
336+ # PNaCl only defines isascii if __STRICT_ANSI__ is not defined,
337+ # always prefer GNU dialect.
338+ try_cxx_flag(GNUXX14 "-std=gnu++14" )
339+ if (NOT FLAG_GNUXX14)
340+ try_cxx_flag(GNUXX1Y "-std=gnu++1y" )
341+ if (NOT FLAG_GNUXX1Y)
342+ message (FATAL_ERROR "GNU++14 is not supported by the compiler" )
343+ endif ()
342344 endif ()
343345 endif ()
344346 endif ()
0 commit comments