Comments (6)
We know that using find_package and relying on the CMake behavior to find the dependencies is something that should be avoided in favor of the information provided by the package manager.
Conan has an abstraction over the packages build system and description by using generators. Those generators translate the information of the dependency graph and create a suitable file that can be consumed by your build system.
In the past, we have found that the logic of some of the find and config files lead to broken scenarios with other dependencies and hardcoded paths that would make the package broken when shared and consumed.
Thus, we think that Conan already provides ways to consume those packages in the same way by using cmake_find_package
generator: https://docs.conan.io/en/latest/reference/generators/cmake_find_package.html
That way all the information is consistent in the graph and you also point to the exact dependency package you want to use.
Please take a look at the integrations section to learn how to use it: https://docs.conan.io/en/latest/integrations/build_system/cmake/cmake_find_package_generator.html
Finally, by not allowing these files (and others such as pkg-config) we make packages agnostic to the consumer as the logic of those files is not in the package but in the way the consumer wants the information.
from conan-center-index.
As this might be a recurrent question, I have added this to the FAQ section of the wiki: https://github.com/conan-io/conan-center-index/wiki/FAQ#why-are-cmake-findconfig-files-and-pkg-config-files-not-packaged
from conan-center-index.
@jargonzombies please take a look in conan-io/conan#6269 (comment)
from conan-center-index.
Thanks for clarification.
Consider it closed.
While this approach definitely works, there might be some issues while migrating to it, I've got the following issue with gtest. I introduce it as following:
find_package( GTest 1.8.0 REQUIRED)
And got en error:
CMake Error at /usr/local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
Could NOT find GTest (missing: GTEST_LIBRARY GTEST_INCLUDE_DIR
GTEST_MAIN_LIBRARY) (Required is at least version "1.8.0")
Call Stack (most recent call first):
/usr/local/share/cmake-3.15/Modules/FindPackageHandleStandardArgs.cmake:378 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-3.15/Modules/FindGTest.cmake:197 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:60 (find_package)
Using find_package( gtest 1.8.0 REQUIRED)
avoids this issue.
from conan-center-index.
Yes, this is something we are aware of and recently introduced a new field for recipes to declare a different name that can be later used by those generators.
In the case of the requirement of gtest/<version>
, the recipe could declare:
...
def package_info(self):
self.cpp_info.name = "GTest"
...
The generator will pick that name and something like find_package(GTest <version> REQUIRED)
should just work 😄
Check self.cpp_info.name
here https://docs.conan.io/en/latest/reference/conanfile/attributes.html#cpp-info for more information
from conan-center-index.
@danimtb Could you please elaborate your answer regarding config files? The technical reason why config files are disavowed is not clear to me from the FAQ or the text here. Could you maybe provide some links to past issues?
from conan-center-index.
Related Issues (20)
- [request] ocilib/4.7.6
- [package] pango/1.51.0: Missing dependency HOT 1
- [package] boost/1.85.0: GCC on macOS fails to compile from_exception.cpp HOT 1
- [package] libgpiod/any: Snapshots are not available HOT 2
- [package] lmdb/0.9.31: compromised? HOT 1
- [request] <folly>/<v2024.05.02.00> HOT 2
- [question] Bzip 1.0.8 build failed! HOT 3
- [package] gtest/1.14.0: gtest recipe suddenly does not support current version of conan HOT 1
- libwebsockets: error building when not using OpenSSL HOT 2
- [boost] boost::dll/1.85.0: undefined reference to `dlopen' HOT 2
- [GTest] : PR #23856 breaks GTest for users who are still on conan 2.0.x
- [package] cppcheck/2.14: Does not compile on Windows
- [request] freertos-kernel/11.1.0
- onnxruntime for web
- [package] libarchive/3.7.4: openssl/3.2.1 integration issue
- [package] open62541/1.3.3: mbedtls/2.16.3 integration issue
- [package] libcurl/*: build error with sanitizers and shared linkage
- [package] tesseract/5.3.3: Build fails with MSVC debug HOT 3
- [package] boost / 1.71.0 : missing package ca891ed5c8e67ebb3e46639c100abdbca6d8b11e HOT 3
- [package] qt/6.7.0: Cross build to android fails
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from conan-center-index.