2

I've got some problem with conan package manager When I run this command on my command line

conan install .. --build=missing

but i got some error in my conanfile.py

Hello/0.1@mohammad/stable: ERROR: Package '90ee443cae5dd5c1b4861766ac14dc6fae231a92' build failed

Hello/0.1@mohammad/stable: WARN: Build folder /home/mohammad/.conan/data/Hello/0.1/mohammad/stable/build/90ee443cae5dd5c1b4861766ac14dc6fae231a92

ERROR: Hello/0.1@mohammad/stable: Error in build() method, line 14 cmake = CMake(self.settings) ConanException: First argument of CMake() has to be ConanFile. Use CMake(self)

This is my conanfile.py

 import os, platform

 class HelloConan(ConanFile):
 name = "Hello"
 version = "0.1"
 settings = "os", "compiler", "build_type", "arch"

 def source(self):
    self.run("git clone https://github.com/memsharded/hello.git")

 def build(self):
    cmake = CMake(self.settings)
    self.run('cmake hello %s' % (cmake.command_line))
    self.run('cmake --build . %s' % cmake.build_config)

 def package(self):
    self.copy("*.h", dst="include", src="hello")
    self.copy("*.lib", dst="lib", keep_path=False)
    self.copy("*.a", dst="lib", keep_path=False)

 def package_info(self):
    self.cpp_info.libs = ["hello"]
1
  • 1
    It seems that you are using a deprecated syntax. Not only for the CMake(self.settings), but you might also take advantage of the cmake.configure(), cmake.build(), etc., methods Commented Aug 8, 2018 at 17:20

1 Answer 1

3

The error message clearly says what's wrong:

First argument of CMake() has to be ConanFile. Use CMake(self)

You are passing self.settings instead:

cmake = CMake(self.settings)
Sign up to request clarification or add additional context in comments.

1 Comment

To extend on the answer, which is correct, it seems that you are using a very outdated recipe style, much before conan 1.0 (i.e. while conan was still in beta). I'd recommend making sure that you are using the latest documentation. If you found such CMake(self.settings) in the docs, please report it inmediately to github.com/conan-io/docs, so it gets fixed.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.