From 7ccda26f3423760623123774da0b3cbaa0e59956 Mon Sep 17 00:00:00 2001 From: trompetin17 Date: Sun, 15 Jun 2025 23:30:09 -0500 Subject: [PATCH] Use `cppdialect "C++17"` instead of per-action buildoptions Premake 5.0.0-alpha12 (released in August 2017) introduced the `cppdialect` directive, which provides a cleaner and more portable way to specify the C++ standard across compilers and platforms. Previously, we used manual per-action buildoptions: filter "action:vs*" buildoptions { "/std:c++17" } filter "action:not vs*" buildoptions { "-std=c++17" } This workaround was necessary due to the limitations of older Premake versions (particularly Premake 4), which lacked built-in support for setting the C++ language standard. Now that we're using a newer version of Premake 5, we can simplify this setup by using: cppdialect "C++17" This results in cleaner, more maintainable build scripts with consistent behavior across toolchains. --- build/premake/premake5.lua | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/build/premake/premake5.lua b/build/premake/premake5.lua index 3ee39b61d0..2c92e34c61 100644 --- a/build/premake/premake5.lua +++ b/build/premake/premake5.lua @@ -250,13 +250,6 @@ function project_set_build_flags() defines { "CONFIG2_MINIUPNPC=0" } end - -- Enable C++17 standard. - filter "action:vs*" - buildoptions { "/std:c++17" } - filter "action:not vs*" - buildoptions { "-std=c++17" } - filter {} - -- various platform-specific build flags if os.istarget("windows") then @@ -437,6 +430,7 @@ function project_create(project_name, target_type) project(project_name) language "C++" + cppdialect "C++17" kind(target_type) filter "action:vs2017"