Replies: 1 comment 1 reply
-
Sort of? You do need to override that function, but if you're just looking to modify that one line, you can cheat a bit: premake.override(m, "projectReferences", function (oldfn, prj)
local refs = project.getdependencies(prj, 'linkOnly')
local oldpush = premake.push
premake.override(premake, "push", function (oldfn2, el, ...)
oldpush = oldfn2
-- Check if el is the project reference and then match ... with a relpath from refs
if match then
oldfn2('<ProjectReference Include=\"%s\" Condition...', ...)
else
oldfn2(el, ...)
end
end)
-- Call old projectReferences now that we have overridden p.push
oldfn(prj)
-- Restore so you only override p.push for this function
premake.push = oldpush
end)It's not pretty, but that's what I'd do for a temporary workaround until I had time to submit a proper solution back. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
filter { "platforms:linux" } links { "projectName" }When generating a Visual Studio project, assuming the above lua code where the links should only apply for the Linux platform, a ProjectReference will get created without any condition such that it becomes a dependency for every system in the project. It will produce something like this:
<ItemGroup> <ProjectReference Include="projectName.vcxproj"> <Project>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</Project> </ProjectReference> </ItemGroup>I looked at the code in vs2010_vcxproj.lua and it indeed does not write with any conditions:

If I would like to have ProjectReference with the configuration condition such that it will produce something like the following, is my only option to override the whole m.projectReferences function?
<ItemGroup> <ProjectReference Include="projectName.vcxproj" Condition="'$(Platform)'=='Linux'"> <Project>{XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX}</Project> </ProjectReference> </ItemGroup>Beta Was this translation helpful? Give feedback.
All reactions