1
0
forked from mirrors/0ad

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.
This commit is contained in:
trompetin17
2025-06-15 23:30:09 -05:00
parent bd15b87be6
commit 7ccda26f34
+1 -7
View File
@@ -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"