conan
conan copied to clipboard
[bug] `conan install` does not honor `config_options`
The behavior between conan create and conan install are not the same and the later is not behaving like described within the documentation.
Environment Details (include every applicable attribute)
- Operating System+version: Windows 10
- Compiler+version: MSVC 2019
- Conan version: latest (1.51.1)
- Python version: 3.10.2
Steps to reproduce
Define conanfile.py:
from conans import ConanFile
class DemoConan(ConanFile):
name = "demo"
version = "1.0.0"
settings = "os", "compiler", "build_type", "arch"
options = {"shared": [True, False], "fPIC": [True, False]}
default_options = {"shared": False, "fPIC": True}
def config_options(self):
if self.settings.os == "Windows":
del self.options.fPIC
Execute once
conan create . -o fPIC=True
and once
conan install . -o fPIC=True
In the first case, Conan raise an error as documented here:
ERROR: demo/1.0.0: option 'fPIC' doesn't exist
Possible options are ['shared']
Instead, in the case of conan install, Conan doesn't raise any error. For some reasons, conan doesn't seem to honor the conifig_options. This can be confirmed by executing conan install with an invalid option:
conan install . -o foo=True
ERROR: conanfile.py: option 'foo' doesn't exist
Possible options are ['shared', 'fPIC']