[question] Is new cmake_layout compatible with cpp_info.components ?
See original GitHub issueHi, 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!
- I’ve read the CONTRIBUTING guide.
Issue Analytics
- State:
- Created 2 years ago
- Comments:8 (8 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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 theself.dependencies, to newcpp_infostructure definitions.)on my way!