Skip to content

Commit 7460a4b

Browse files
committed
add test for #17942
1 parent 7777a0e commit 7460a4b

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

test/integration/toolchains/cmake/cmakedeps2/test_cmakedeps.py

+28
Original file line numberDiff line numberDiff line change
@@ -198,3 +198,31 @@ def package_info(self):
198198
c.run("create . --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
199199
assert "CMakeConfigDeps: cmake_set_interface_link_directories deprecated and invalid. " \
200200
"The package 'package_info()' must correctly define the (CPS) information" in c.out
201+
202+
def test_consuming_cpp_info_with_components_dependency_from_same_package():
203+
c = TestClient()
204+
conanfile = textwrap.dedent("""
205+
from conan import ConanFile
206+
class Pkg(ConanFile):
207+
def package_info(self):
208+
self.cpp_info.components["lib"].type = 'shared-library'
209+
self.cpp_info.components["lib_extended"].type = 'shared-library'
210+
self.cpp_info.components["lib_extended"].requires = ['lib']
211+
""")
212+
test_package = textwrap.dedent("""
213+
from conan import ConanFile
214+
class TestPkg(ConanFile):
215+
settings = "os", "compiler", "arch", "build_type"
216+
generators = "VirtualRunEnv", "CMakeDeps"
217+
218+
def requirements(self):
219+
self.requires(self.tested_reference_str)
220+
221+
def test(self):
222+
pass
223+
""")
224+
c.save({"conanfile.py": conanfile,
225+
"test_package/conanfile.py":test_package})
226+
227+
c.run("create . --name=pkg --version=0.1 -c tools.cmake.cmakedeps:new=will_break_next")
228+
assert "(test package): Running test()'" in c.out

0 commit comments

Comments
 (0)