Skip to content

Commit

Permalink
Set per file build options
Browse files Browse the repository at this point in the history
  • Loading branch information
JoelLinn committed Sep 15, 2021
1 parent 143e666 commit 4259988
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion cmake_project.lua
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,26 @@ function m.generate(prj)
_p(2, '$<$<COMPILE_LANGUAGE:CXX>:%s>', flag)
end
_p(1, ')')
_p(')')

-- setting per fille build options
table.foreachi(prj._.files, function(node)
local fcfg = p.fileconfig.getconfig(node, cfg)
if fcfg then
toolset_flags = {}
if path.iscfile(fcfg.name) then
toolset_flags = toolset.getcflags(fcfg)
elseif path.iscppfile(fcfg.name) then
toolset_flags = toolset.getcppflags(fcfg)
end
file_build_options = table.concat(table.join(toolset_flags, fcfg.buildoptions), " ")
if file_build_options ~= "" then
_p(1,
'set_source_files_properties("%s" PROPERTIES COMPILE_FLAGS "%s")',
path.getrelative(prj.workspace.location, fcfg.abspath),
file_build_options)
end
end
end)

-- C++ standard
-- only need to configure it specified
Expand Down

0 comments on commit 4259988

Please sign in to comment.