Details
-
Bug
-
Resolution: Fixed
-
Not Evaluated
-
Qt Creator 14.0.2
-
2103a9a77 (15.0)
Description
User described following bug for Conan Plugin: "Conan (experimental):
"
To reproduce, you need to have the conan package manger installed (see https://docs.conan.io/2/installation.html)
Once installed, ensure that in QtCreator Preferences, under CMake, the check box "Package Manager Auto Setup" is checked.
- Reproduce *
On the command line, create a new cmake_exe Project via conan:
mkdir demo
cd demo
conan new cmake_exe -d name=demo -d version=1.
In QtCreator open .../demo/CMakeLists.txt, in the Projects View right click on the project "demo" and select "Run CMake".
Result: the following error is printed in the General Messages window:
[cmake] ERROR: conanfile.py (demo/1.0): Error in generate() method, line 28
[cmake] deps.generate()
[cmake] ConanException: CMakeDeps is declared in the generators attribute, but was instantiated in the generate() method too. It should only be present in one of them.
For some reason it seems that when this conanfile.py is processed in function generate() the object self.generators contains an entry "CMakeDeps" although there is no place in the conanfile where this would have occurred.
"
User has also found a workaround:
"
We found a workaround for the problem: It is possible to detect whether Conan was invoked from Qt Creator using environment Variable "QTC_RUN". When that is the case we can clear the "generators" variable, then the error does not appear.
def generate(self):
if getenv("QTC_RUN"):
self.output.highlight("Running within Qt Creator – deploy workaround")
self.generators.clear()
deps = CMakeDeps(self)
deps.generate()
tc = CMakeToolchain(self)
tc.generate()
"