Skip to content

Commit

Permalink
Add MSVC runtime library support
Browse files Browse the repository at this point in the history
  • Loading branch information
MarcasRealAccount committed Dec 7, 2022
1 parent 87e2f20 commit 33fbf4c
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions cmake_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,17 @@ m.nonldflags = {
}
}

m.msvcRuntimeLibraries = {
On = {
Debug = "MultiThreadedDebug",
Release = "MultiThreaded"
},
Off = {
Debug = "MultiThreadedDebugDLL",
Release = "MultiThreadedDLL"
}
}

function cmake.generateProject(prj)
prj.__cmake = {}
prj.__cmake.files = {}
Expand Down Expand Up @@ -123,6 +134,7 @@ m.configProps = function(prj, cfg)
m.outputDirs,
m.includeDirs,
m.defines,
m.msvcRuntimeLibrary,
m.libDirs,
m.libs,
m.buildOptions,
Expand Down Expand Up @@ -237,6 +249,18 @@ function m.defines(prj, cfg)
timer.stop()
end

function m.msvcRuntimeLibrary(prj, cfg)
local timer = cmake.common.createTimer("p.extensions.cmake.project.runtimeLibrary", { prj.name, cmake.common.configName(cfg, #prj.workspace.platforms > 1) })
local static = m.msvcRuntimeLibraries[cfg.staticruntime]
if static then
local runtime = static[cfg.runtime]
if runtime then
p.w("set_property(TARGET \"%s\" PROPERTY MSVC_RUNTIME_LIBRARY \"%s\")", prj.name, runtime)
end
end
timer.stop()
end

function m.libDirs(prj, cfg)
local timer = cmake.common.createTimer("p.extensions.cmake.project.libDirs", { prj.name, cmake.common.configName(cfg, #prj.workspace.platforms > 1) })
if #cfg.libdirs > 0 then
Expand Down

0 comments on commit 33fbf4c

Please sign in to comment.