[question] `CMakeDeps` failed on header only libs
See original GitHub issueconanfile.py
requires = ["rapidjson/cci.20200410"]
generators = ["CMakeDeps", "CMakeToolchain"]
$ conan create .
...
ERROR: Error in generator 'CMakeDeps': 'settings.build_type' doesn't exist
Does it mean that CMakeDeps
can not be used if any lib in requires
has no build_type
settings?
conafile.py for rapidjson
from conans import ConanFile, tools
import os
required_conan_version = ">=1.33.0"
class RapidjsonConan(ConanFile):
name = "rapidjson"
description = "A fast JSON parser/generator for C++ with both SAX/DOM style API"
topics = ("conan", "rapidjson", "json", "parser", "generator")
url = "https://github.com/conan-io/conan-center-index"
homepage = "http://rapidjson.org"
license = "MIT"
no_copy_source = True
@property
def _source_subfolder(self):
return "source_subfolder"
def source(self):
tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)
def package(self):
self.copy(pattern="license.txt", dst="licenses", src=self._source_subfolder)
self.copy(pattern="*", dst="include", src=os.path.join(self._source_subfolder, "include"))
def package_id(self):
self.info.header_only()
def package_info(self):
self.cpp_info.names["cmake_find_package"] = "RapidJSON"
self.cpp_info.names["cmake_find_package_multi"] = "RapidJSON"
Issue Analytics
- State:
- Created 2 years ago
- Comments:9 (4 by maintainers)
Top Results From Across the Web
[question] How to work in Debug mode with CMakeDeps and ...
Hi, I have a header-only library with cmake generator and it works fine. I've migrated it to CMakeDeps and CMakeToolchain.
Read more >CMake include header-only-library into another library, make fail
library B (libB) is a header only library in my view (correct me if I'm using the incorrect terms). So libA actually 'uses'...
Read more >Changelog — conan 1.56.0 documentation
#11759; Bugfix: The CMakeDeps generator failed for consumers with CMake projects ... It will impact header-only libraries that are consumed using targets ...
Read more >How do you use a header-only library package in ROS2?
The Problem (in short) I'm trying to create and use a header-only library package in ROS2 Foxy. However the compilation fails with a...
Read more >Why is it that package managers are unnecessarily hard? : r/cpp
This is the answer! The problem is that conan declared that libraries are in CONFIG:Release.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
The lib will not be duplicated because it does not have the build_type setting, it’s deleted because it’s a header only and will have only one package_id, please read more about this here: https://docs.conan.io/en/latest/howtos/header_only.html
That’s because you are using cmake_find_package generator there and will not need it.
Hi @playgithub, As I said, you have to add at least the
build_type
setting to the conanfile. TheCMakeDeps
generator needs that setting information. So please add:settings = "build_type"
to the consumer’s conanfile like this:Some other conan generators may not need this setting.