Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi-generators cannot be used without 'build_type' setting #6228

Merged
merged 4 commits into from Dec 20, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 1 addition & 4 deletions conans/client/generators/cmake_find_package_multi.py
Expand Up @@ -95,7 +95,7 @@ def filename(self):
@property
def content(self):
ret = {}
build_type = self.conanfile.settings.get_safe("build_type")
build_type = str(self.conanfile.settings.build_type)
build_type_suffix = "_{}".format(build_type.upper()) if build_type else ""
for _, cpp_info in self.deps_build_info.dependencies:
depname = cpp_info.get_name("cmake_find_package_multi")
Expand All @@ -110,9 +110,6 @@ def content(self):
format(version=cpp_info.version)
return ret

def _build_type_suffix(self, build_type):
return

def _find_for_dep(self, name, cpp_info):
lines = []
if cpp_info.public_deps:
Expand Down
2 changes: 1 addition & 1 deletion conans/client/generators/visualstudio_multi.py
Expand Up @@ -15,7 +15,7 @@ def __init__(self, settings):
raise ConanException("Undefined Visual Studio version %s" %
settings.get_safe("compiler.version"))

self._props = [("Configuration", settings.get_safe("build_type")),
self._props = [("Configuration", settings.build_type),
("Platform", {'x86': 'Win32',
'x86_64': 'x64'}.get(settings.get_safe("arch"))),
("PlatformToolset", toolset)]
Expand Down
32 changes: 32 additions & 0 deletions conans/test/functional/generators/multi_generators_test.py
@@ -0,0 +1,32 @@
import textwrap
import unittest

from parameterized import parameterized

from conans.test.utils.tools import TestClient


class MultiGeneratorsTestCase(unittest.TestCase):

@parameterized.expand([("cmake_find_package_multi",),
("visual_studio_multi", ),
("cmake_multi", )])
def test_no_build_type_test(self, generator):
client = TestClient()

conanfile = textwrap.dedent("""
from conans import ConanFile, CMake

class Conan(ConanFile):
settings = "os", "arch", "compiler"
generators = "{generator}"

def build(self):
cmake = CMake(self)
cmake.configure()
""".format(generator=generator))

client.save({"conanfile.py": conanfile})
client.run('install . -s compiler="Visual Studio"'
' -s compiler.version=15 -s compiler.toolset=v100', assert_error=True)
self.assertIn("ERROR: 'settings.build_type' doesn't exist", client.out)