Skip to content

Commit f3e6bdc

Browse files
committed
Requirement!
1 parent 3673378 commit f3e6bdc

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

test/integration/cps/test_cps.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,21 +271,32 @@ class mypkgRecipe(ConanFile):
271271
name = "mypkg"
272272
version = "0.1"
273273
274+
requires = "dep/0.1"
275+
274276
def package(self):
275277
save(self, os.path.join(self.package_folder, "lib", "libcore.a"), "")
276278
277279
def package_info(self):
278280
self.cpp_info{cpp_info_comp}.libs = ["core"]
281+
self.cpp_info{cpp_info_comp}.requires = ["dep::comp1"]
279282
from conan.cps import CPS
280283
cps = CPS.from_conan(self)
281284
self.cpp_info = cps.to_conan()
282285
""")
283-
c.save({"conanfile.py": conanfile})
286+
c.save({"conanfile.py": conanfile,
287+
"dep/conanfile.py": GenConanfile("dep", "0.1")
288+
.with_package_file("lib/comp1.a", "-")
289+
.with_package_file("lib/comp2.a", "-")
290+
.with_package_info(cpp_info={"components": {"comp1": {"libs": ["comp1"]},
291+
"comp2": {"libs": ["comp2"]}}})})
292+
c.run("create dep")
284293
c.run("create")
285294
c.run(f"install --requires=mypkg/0.1 -g CMakeConfigDeps")
286295
mypkg_targets = c.load("mypkg-Targets-release.cmake")
287296
if as_comp:
288297
assert "add_library(mypkg::core" in mypkg_targets
298+
assert "# Requirement mypkg::core -> dep::comp1" in mypkg_targets
289299
else:
290300
assert "add_library(mypkg::core" not in mypkg_targets
291301
assert "add_library(mypkg::mypkg" in mypkg_targets
302+
assert "# Requirement mypkg::mypkg -> dep::comp1" in mypkg_targets

0 commit comments

Comments
 (0)