-1

I have a solution with many projects, for one of them I need to install conan package, but only if this project will be chosen to build. I am building my projects with QBS. I tried to use Probes.ConanfileProbe in qbs file, but it seems that conan installs the package while resolving the project.

Daria
  • 1
  • Hi Daria. In order to get help you need to provide way more information. Code that can be reproduced, a ``conanfile.py`` minimal to show, the contents of ``Probes.ConanfileProbe``, etc, etc. What is called a "minimal reproducible example", that can be used by readers to help. – drodri Sep 05 '22 at 18:40
  • Please rephrase your question. What does "the project" mean? Is that a Project item in your Qbs project which is conditionally enabled? If the ConanfileProbe is enabled in a project, it will run Conan install. That is the expected behavior. The probe is executed when resolving the Qbs project, not when "building" the artifacts. The only way to prevent the probe from running is, to set the condition property to false. You may want to bind the condition to the project's condition property. I don't know if that's possible. – Richard W Sep 05 '22 at 22:32

1 Answers1

0

I found the way: you need to create the condition inside Probs:

condition: {
            var enabled = Environment.getEnv("BUILD")
            return enabled !== undefined || enabled.split(";").indexOf(name) !== -1
        }

so, if you want to build project, you initialize BUILD env variable

Daria
  • 1