cmake错误与find_package无法正确比较版本

发布于 2025-02-08 08:24:10 字数 1187 浏览 1 评论 0原文

您好,我正在尝试获得一个使用CMAKE运行的C ++项目,但是当构建时,我总是在此行上遇到错误:

find_package(jsoncpp REQUIRED)

错误是:

[cmake] CMake Error at src/scouting/CMakeLists.txt:12 (find_package):
[cmake]   Could not find a configuration file for package "jsoncpp" that is
[cmake]   compatible with requested version "".
[cmake] 
[cmake]   The following configuration files were considered but not accepted:
[cmake] 
[cmake]     /home/moritz/Schreibtisch/DA/airclipObstacleDetection/lib/jsoncpp/build/jsoncppConfig.cmake, version: 1.9.2 (64bit)

我意识到它说请求版本“”,所以我将行更改为:

find_package(jsoncpp 1.9.2 REQUIRED)

现在错误是:

[cmake] CMake Error at src/scouting/CMakeLists.txt:12 (find_package):
[cmake]   Could not find a configuration file for package "jsoncpp" that is
[cmake]   compatible with requested version "1.9.2".
[cmake] 
[cmake]   The following configuration files were considered but not accepted:
[cmake] 
[cmake]     /home/moritz/Schreibtisch/DA/airclipObstacleDetection/lib/jsoncpp/build/jsoncppConfig.cmake, version: 1.9.2 (64bit)

1.9.2与1.9.2完全不兼容?我猜“(64位)”是关键吗?但是我无法将其添加到find_package中,对吗?

Hello I'm trying to get a C++ project to run with cmake but when building I always get an error on this line:

find_package(jsoncpp REQUIRED)

the error being:

[cmake] CMake Error at src/scouting/CMakeLists.txt:12 (find_package):
[cmake]   Could not find a configuration file for package "jsoncpp" that is
[cmake]   compatible with requested version "".
[cmake] 
[cmake]   The following configuration files were considered but not accepted:
[cmake] 
[cmake]     /home/moritz/Schreibtisch/DA/airclipObstacleDetection/lib/jsoncpp/build/jsoncppConfig.cmake, version: 1.9.2 (64bit)

I realized it says requested version "" so I changed the line to:

find_package(jsoncpp 1.9.2 REQUIRED)

now the error is:

[cmake] CMake Error at src/scouting/CMakeLists.txt:12 (find_package):
[cmake]   Could not find a configuration file for package "jsoncpp" that is
[cmake]   compatible with requested version "1.9.2".
[cmake] 
[cmake]   The following configuration files were considered but not accepted:
[cmake] 
[cmake]     /home/moritz/Schreibtisch/DA/airclipObstacleDetection/lib/jsoncpp/build/jsoncppConfig.cmake, version: 1.9.2 (64bit)

How is 1.9.2 not compatible with exactly 1.9.2? I guess the "(64bit)" is the key? but I can't add that into find_package, right?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

嘦怹 2025-02-15 08:24:10

错误消息的关键部分是

(64bit)

它告诉特定的配置文件描述 64bit 安装,但是您的cmake项目正在为 32bit 配置。

您需要选择项目的目标平台的另一个位置(例如,Visual Studio Generators允许:

The key part of the error message is

(64bit)

It tells that the specific configuration file describes 64bit installation, but your CMake project is being configured for 32bit.

You need either to choose another bitness of the target platform for your project (e.g. Visual Studio generators allow that: https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2017%202022.html) or to use other installation of 3d-party package.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文