且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

CMake找到Boost,但导入的目标不适用于Boost版本

更新时间:2022-06-25 03:48:15

您的CMake版本太旧.更新CMake,它将起作用.

Your CMake version is too old. Update CMake and it will work.

CMake无法检测到不同Boost库之间的依赖关系.它们已在FindBoost中明确实现.
对于每个Boost版本,此信息均由CMake维护人员添加,并成为下一CMake版本的一部分.因此,您必须确保在尝试找到的Boost版本之后发布了您的CMake版本.

CMake cannot detect the dependencies between the different Boost libraries. They have explicitly implemented in FindBoost.
For every Boost release this information is added by the CMake maintainers and it gets part of the next CMake release. So you have to make sure, that your CMake version was released after the Boost version you try to find.

Boost 1.63需要CMake 3.7或更高版本.
Boost 1.64需要CMake 3.8或更高版本.
Boost 1.65和1.65.1需要CMake 3.9.3或更高版本.
Boost 1.66需要CMake 3.11或更高版本.
Boost 1.67需要CMake 3.12或更高版本.
Boost 1.68、1.69需要CMake 3.13或更高版本.
Boost 1.70需要CMake 3.14或更高版本.
Boost 1.71需要CMake 3.15.3或更高版本.
Boost 1.72需要CMake 3.16.2或更高版本.
Boost 1.73需要CMake 3.17.2或更高版本.

Boost 1.63 requires CMake 3.7 or newer.
Boost 1.64 requires CMake 3.8 or newer.
Boost 1.65 and 1.65.1 require CMake 3.9.3 or newer.
Boost 1.66 requires CMake 3.11 or newer.
Boost 1.67 requires CMake 3.12 or newer.
Boost 1.68, 1.69 require CMake 3.13 or newer.
Boost 1.70 requires CMake 3.14 or newer.
Boost 1.71 requires CMake 3.15.3 or newer.
Boost 1.72 requires CMake 3.16.2 or newer.
Boost 1.73 requires CMake 3.17.2 or newer.

从版本1.70开始,Boost提供了一个BoostConfig.cmake,它使FindBoost和必需的更改过时.使用

Starting with version 1.70, Boost provides a BoostConfig.cmake that obsoletes FindBoost and the required changes. Using

find_package(Boost CONFIG)

不排除FindBoost文件,仅搜索配置文件. 虽然有一些方法可以将FindBoost从CMake中删除,但因为它将破坏对版本的支持在1.70之前的版本中,CMake正在等待执行此步骤.尽管如此,这还是在将来的CMake发行版中摆脱该版本混乱的方法.

does exclude the FindBoost file and searches only for the config file. There are thoughs to drop FindBoost from CMake, but as it would break support for versions prior 1.70, CMake is waiting to do this step. Still, this is the way to get rid of this version mess in future CMake releases.