From 21c6f861a205f6c549eb22da4902dfd3b3106273 Mon Sep 17 00:00:00 2001 From: vertexpotato Date: Wed, 21 Jul 2021 13:23:43 +0300 Subject: [PATCH] support cmake executable suffix option --- _preload.lua | 8 ++++++++ cmake_project.lua | 4 ++++ 2 files changed, 12 insertions(+) diff --git a/_preload.lua b/_preload.lua index 4e0cc59..a035527 100644 --- a/_preload.lua +++ b/_preload.lua @@ -6,12 +6,20 @@ -- Andrew Gough -- Manu Evans -- Yehonatan Ballas +-- UndefinedVertex -- Created: 2013/05/06 -- Copyright: (c) 2008-2020 Jason Perkins and the Premake project -- local p = premake +-- support cmake executable_suffix +p.api.register { + name = "executable_suffix", + scope = "config", + kind = "string", +} + newaction { -- Metadata for the command line and help system diff --git a/cmake_project.lua b/cmake_project.lua index 6b71dda..ef61017 100755 --- a/cmake_project.lua +++ b/cmake_project.lua @@ -7,6 +7,7 @@ -- Tom van Dijck -- Yehonatan Ballas -- Joel Linn +-- UndefinedVertex -- Created: 2013/05/06 -- Copyright: (c) 2008-2020 Jason Perkins and the Premake project -- @@ -54,6 +55,9 @@ function m.generate(prj) elseif prj.kind == 'SharedLib' then _p('add_library("%s" SHARED', prj.name) else + if prj.executable_suffix then + _p('set(CMAKE_EXECUTABLE_SUFFIX "%s")', prj.executable_suffix) + end _p('add_executable("%s"', prj.name) end m.files(prj)