Skip to content

Commit

Permalink
allow to disable automatic injection of dependencies props
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceIm committed Jan 2, 2023
1 parent d0fc429 commit 86762f7
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions conan/tools/microsoft/msbuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,16 @@ def __init__(self, conanfile):
self.platform = msvc_arch
self.toolset = msvs_toolset(conanfile)

def command(self, sln, targets=None):
def command(self, sln, targets=None, auto_inject_deps_props=True):
cmd = (f'msbuild "{sln}" /p:Configuration={self.build_type} '
f"/p:Platform={self.platform} /p:PlatformToolset={self.toolset}")

# Autoconsume toolchain props, but opt-out dependencies props
props_paths = []
for props_file in (MSBuildToolchain.filename, MSBuildDeps.filename):
props_candidates = [MSBuildToolchain.filename]
if auto_inject_deps_props:
props_candidates.append(MSBuildDeps.filename)
for props_file in props_candidates:
props_path = os.path.join(self._conanfile.generators_folder, props_file)
if os.path.exists(props_path):
props_paths.append(props_path)
Expand All @@ -63,8 +67,8 @@ def command(self, sln, targets=None):

return cmd

def build(self, sln, targets=None):
cmd = self.command(sln, targets=targets)
def build(self, sln, targets=None, auto_inject_deps_props=True):
cmd = self.command(sln, targets=targets, auto_inject_deps_props=auto_inject_deps_props)
self._conanfile.run(cmd)

@staticmethod
Expand Down

0 comments on commit 86762f7

Please sign in to comment.