question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[bug] 1.49.0: KeyError: 'include' in CMakeToolchain generator

See original GitHub issue

Environment Details (include every applicable attribute)

  • Operating System+version: docker container running ubuntu:latest
  • Compiler+version: g++ 11
  • Conan version: 1.49.0
  • Python version: 3.10.4

Steps to reproduce (Include if Applicable)

Create a folder containing the following files:

  • Empty CMakeLists.txt
  • Empty CMakePresets.json
  • CMakeUserPresets.json containing only {} (an empty file will give a different error)

Create a conanfile.py with the following content:

from conan import ConanFile


class Recipe(ConanFile):
    settings = "os", "compiler", "build_type", "arch"
    generators = "CMakeToolchain"

    def layout(self):
        self.folders.generators = "conan"

run conan install .

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

Output using 1.49.0:

root@167b965bb085:~# conan install -pr:b=default -pr:h=default .
Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

conanfile.py: Installing package
Requirements
Packages

Installing (downloading, building) binaries...
conanfile.py: Generator txt created conanbuildinfo.txt
conanfile.py: Generator 'CMakeToolchain' calling 'generate()'
conanfile.py: ERROR: Traceback (most recent call last):
  File "/usr/local/lib/python3.10/dist-packages/conans/client/generators/__init__.py", line 177, in write_generators
    generator.generate()
  File "/usr/local/lib/python3.10/dist-packages/conan/tools/cmake/toolchain/toolchain.py", line 178, in generate
    write_cmake_presets(self._conanfile, toolchain, self.generator)
  File "/usr/local/lib/python3.10/dist-packages/conan/tools/cmake/presets.py", line 124, in write_cmake_presets
    if preset_path not in data["include"]:
KeyError: 'include'

ERROR: Error in generator 'CMakeToolchain': 'include'

Output using 1.48.2:

root@167b965bb085:~# conan install -pr:b=default -pr:h=default .
Configuration (profile_host):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++
compiler.version=11
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

conanfile.py: Installing package
Requirements
Packages

Installing (downloading, building) binaries...
conanfile.py: Generator 'CMakeToolchain' calling 'generate()'
conanfile.py: Generator txt created conanbuildinfo.txt
conanfile.py: Aggregating env generators
conanfile.py: Generated conaninfo.txt
conanfile.py: Generated graphinfo

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
sykhrocommented, Jun 14, 2022

unless CMake will not fail because of adding some extra fields in the json.

CMakePresets have a “vendor” section so that third party tools can add their information there.

0reactions
jcar87commented, Jun 16, 2022
Read more comments on GitHub >

github_iconTop Results From Across the Web

Changelog — conan 1.49.0 documentation
Docs here; Feature: The CMakePresets.json (file generated when specified the CMakeToolchain generator) is appended with a new buildPresets after a conan ...
Read more >
Keyerror 'include' on migrating models to sql server
I have a django application and have backend as Microsoft sql server. ... and same i am migrating, but i am getting below...
Read more >
conanio/conan - Gitter
rcrudo on Freenode I'm using conan with CMake and one of the pakages I need to include uses pkg_check_modules (pkg-config). Conan is not...
Read more >
conan-io/conan 1.49.0 on GitHub - NewReleases.io
New release conan-io/conan version 1.49.0 1.49.0 (02-Jun-2022) on ... Docs:; Feature: Add CMAKE_SYSROOT support for CMakeToolchain .
Read more >
conan Changelog - pyup.io
Feature: Add `.user_presets_path` attribute to `CMakeToolchain` to customize ... Bugfix: Fixed the `cmake_paths`generator to set the root of the packages to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found