-
Notifications
You must be signed in to change notification settings - Fork 27
/
cmake.lua
61 lines (47 loc) · 1.32 KB
/
cmake.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
--
-- Name: cmake.lua
-- Purpose: Define the cmake action(s).
-- Author: Ryan Pusztai
-- Modified by: Andrea Zanellato
-- Andrew Gough
-- Manu Evans
-- Jason Perkins
-- Yehonatan Ballas
-- Created: 2013/05/06
-- Copyright: (c) 2008-2020 Jason Perkins and the Premake project
--
local p = premake
p.modules.cmake = {}
p.modules.cmake._VERSION = p._VERSION
local cmake = p.modules.cmake
local project = p.project
function cmake.generateWorkspace(wks)
p.eol("\r\n")
p.indent(" ")
p.generate(wks, "CMakeLists.txt", cmake.workspace.generate)
end
function cmake.generateProject(prj)
p.eol("\r\n")
p.indent(" ")
if project.isc(prj) or project.iscpp(prj) then
p.generate(prj, ".cmake", cmake.project.generate)
end
end
function cmake.cfgname(cfg)
local cfgname = cfg.buildcfg
if cmake.workspace.multiplePlatforms then
-- CMake breaks if "|" is used here
cfgname = string.format("%s-%s", cfg.platform, cfg.buildcfg)
end
return cfgname
end
function cmake.cleanWorkspace(wks)
p.clean.file(wks, "CMakeLists.txt")
end
function cmake.cleanProject(prj)
p.clean.file(prj, prj.name .. ".cmake")
end
include("cmake_workspace.lua")
include("cmake_project.lua")
include("_preload.lua")
return cmake