Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[bug] toolchainFile key not found #11752

Closed
comargo opened this issue Aug 2, 2022 · 2 comments
Closed

[bug] toolchainFile key not found #11752

comargo opened this issue Aug 2, 2022 · 2 comments
Assignees

Comments

@comargo
Copy link
Contributor

comargo commented Aug 2, 2022

After introducing tools.cmake.cmaketoolchain.presets:max_schema_version #11655 conan build . stops working.

For schema version=2 toolchainFile is not specified, chacheVariable['CMAKE_TOOLCHAIN_FILE'] used instead

if not _forced_schema_2(conanfile):
ret["toolchainFile"] = toolchain_file
else:
ret["cacheVariables"]["CMAKE_TOOLCHAIN_FILE"] = toolchain_file

But conan.tools.cmake.CMake.__init__() doesn't take it in account.

self._generator = configure_preset["generator"]
self._toolchain_file = configure_preset["toolchainFile"]
self._cache_variables = configure_preset["cacheVariables"]

Environment Details (include every applicable attribute)

  • Operating System+version: Windows 10
  • Compiler+version: Visual Studio 17 2022
  • Conan version: 1.51.0
  • Python version: 3.9

Steps to reproduce (Include if Applicable)

mkdir ttt
cd ttt
conan new ttt/0.0.1
conan profile new ttt --detect
conan profile update conf.tools.cmake.cmaketoolchain.presets:max_schema_version=3 ttt
conan install . -pr ttt
conan build .

Logs (Executed commands with output) (Include/Attach if Applicable)

PS C:\imperx\git\cyril\ttt> conan install .
Configuration:
[settings]
arch=x86_64
arch_build=x86_64
build_type=Debug
compiler=Visual Studio
compiler.runtime=MDd
compiler.toolset=v140
compiler.version=17
os=Windows
os_build=Windows
[options]
[build_requires]
[env]
[conf]
tools.cmake.cmaketoolchain.presets:max_schema_version=3

conanfile.py (ttt/0.0.1): Installing package
Requirements
Packages

Installing (downloading, building) binaries...
conanfile.py (ttt/0.0.1): Generator txt created conanbuildinfo.txt
conanfile.py (ttt/0.0.1): Calling generate()
conanfile.py (ttt/0.0.1): WARN: Using the new toolchains and generators without specifying a build profile (e.g: -pr:b=default) is discouraged and might cause failures and unexpected behavior
conanfile.py (ttt/0.0.1): Aggregating env generators
conanfile.py (ttt/0.0.1): Generated conaninfo.txt
conanfile.py (ttt/0.0.1): Generated graphinfo
PS C:\imperx\git\cyril\ttt> conan build .
Using lockfile: 'C:\imperx\git\cyril\ttt/conan.lock'
Using cached profile from lockfile
conanfile.py (ttt/0.0.1): Calling build()
ERROR: conanfile.py (ttt/0.0.1): Error in build() method, line 36
        cmake = CMake(self)
        KeyError: 'toolchainFile'
comargo added a commit to comargo/conan that referenced this issue Aug 2, 2022
comargo added a commit to comargo/conan that referenced this issue Aug 2, 2022
@lasote lasote self-assigned this Aug 2, 2022
comargo added a commit to comargo/conan that referenced this issue Aug 2, 2022
comargo added a commit to comargo/conan that referenced this issue Aug 2, 2022
czoido pushed a commit that referenced this issue Aug 3, 2022
* Add testcase for issue #11752

* Fix issue #11752
@Simran-B
Copy link

@czoido Looks like this issue should be closed because you merged this PR: #11759

@memsharded
Copy link
Member

Thanks for following up @Simran-B, closing the ticket

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants