question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[question] Is new cmake_layout compatible with cpp_info.components ?

See original GitHub issue

Hi, I’ve been using CMakeToolchain for a while with the CMake build helper that comes with it. But after updating today I saw that CMake build helper does not accept a build_folder parameter anymore.

Looking at why it happened I arrived at https://github.com/conan-io/conan/pull/8554/files#diff-d72013a45b00a0adf06f4536d6a8c8844461e51b72911937d63e6dda9a3d440aR64 this means that the new way of providing the folder topology is via def layout(self) right?

My first move was to employ the new cmake_layout utility, but I was unable to create a package if this one used self.cpp_info.components

ERROR: 
	ConanException: say/0.1 package_info(): self.cpp_info.components cannot be used with self.cpp_info global values at the same time

Conanfile example:

from conans import ConanFile, CMake
from conan.tools.layout import cmake_layout, LayoutPackager

class Pkg(ConanFile):
    name = "say"
    version = "0.1"
    settings = "os", "compiler", "arch", "build_type"
    generators = "cmake"
    exports_sources = "src/*"

    def layout(self):
        cmake_layout(self)

    def build(self):
        cmake = CMake(self)
        cmake.configure()
        cmake.build()

    def package(self):
        LayoutPackager(self).package()

    def package_info(self):
        self.cpp_info.components["say"].libs = ["say"]

So, I am doing something wrong? Is this intended or just a bug/missing feature?

Thanks!

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
memshardedcommented, Jul 28, 2021

Hi @Hopobcn

yes, please check the warning notes in https://docs.conan.io/en/latest/reference/conanfile/methods.html#layout.

It is extremely risky to try to introduce the layout() functionality changes in the old generators. Only the new ones will fully support this functionality (Note that internally we are replacing all the logic of the generators to work, from the self.dependencies, to new cpp_info structure definitions.)

0reactions
lasotecommented, Aug 2, 2021

on my way!

Read more comments on GitHub >

github_iconTop Results From Across the Web

cppinfo improvements: components, exe, system deps... #5090
Intro. The idea is to be able to specify different components (different libs, different exes) in the cpp_info object so it can help...
Read more >
Changelog — conan 1.46.2 documentation
#9381; Bugfix: Fixed bug whereby using new layout() method together with cppinfo.components in the package_info method caused an exception.
Read more >
conan Changelog - pyup.io
Bugfix: Fixed bug whereby using new `layout()` method together with `cppinfo.components` in the `package_info` method caused an exception.
Read more >
Conan - The open-source C/C++ package manager
I am using Conan v1.7.4. ... However, the debug build does work (details how to reproduce are below). I think the problem is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found