gpt4 book ai didi

CMake 找不到自定义模块

转载 作者:行者123 更新时间:2023-12-04 06:27:41 32 4
gpt4 key购买 nike

我在 Poco 库中找到了我在/cmake/Modules 下复制的 PocoConfig.cmake

我还在我的 CMakeLists.txt 中添加了:

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/Modules/")

现在我在/Build/cmake 下运行 ..

我不断得到:
CMake Error at CMakeLists.txt:41 (find_package):
By not providing "FindPoco.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "Poco", but
CMake did not find one.

Could not find a package configuration file provided by "Poco" with any of
the following names:

PocoConfig.cmake
poco-config.cmake

Add the installation prefix of "Poco" to CMAKE_PREFIX_PATH or set
"Poco_DIR" to a directory containing one of the above files. If "Poco"
provides a separate development package or SDK, be sure it has been
installed.

显然 CMake 没有找到模块文件。我在做什么错,如何明确地将 CMake 指向该模块文件?

最佳答案

PocoConfig.cmake 不适用于 find_package(否则,它将被命名为 FindPoco.cmake),这就是您收到此错误的原因。

只需在您的 CMakeLists.txt 中包含 PocoConfig.cmake:

include(${CMAKE_SOURCE_DIR}/cmake/Modules/PocoConfig.cmake)

关于CMake 找不到自定义模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16971349/

32 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com