FindLibXml2 的 CMake find_package
CMake find_package for FindLibXml2
我正在尝试创建一个 CMake 文件来检测 libxml2 的位置。从示例和 CMake 文档中可以看出,find_package 可以正常工作。我是 Ubuntu 上的 运行 CLion,libxml2 是使用 apt-get 安装的,FindLibXml2.cmake 位于 CMake 的模块下。但是 CMake returns 神秘消息:
Could not find a package configuration file provided by "FindLibXml2"
with any of the following names:
FindLibXml2Config.cmake
findlibxml2-config.cmake
Add the installation prefix of "FindLibXml2" to CMAKE_PREFIX_PATH or
set "FindLibXml2_DIR" to a directory containing one of the above
files. If "FindLibXml2" provides a separate development package or
SDK, be sure it has been installed.
为什么要查找这个 -config
文件?我做错了什么?
CMake 片段
find_package(FindLibXml2 CONFIG REQUIRED)
我也试过了
find_package(FindLibXml2 REQUIRED)
不确定使用哪一个
你不应该在 FindLibXml2
中有 Find
;做:
find_package(LibXml2 REQUIRED)
如 documentation 中所述:
CMake searches for a file called Find<package>.cmake
我正在尝试创建一个 CMake 文件来检测 libxml2 的位置。从示例和 CMake 文档中可以看出,find_package 可以正常工作。我是 Ubuntu 上的 运行 CLion,libxml2 是使用 apt-get 安装的,FindLibXml2.cmake 位于 CMake 的模块下。但是 CMake returns 神秘消息:
Could not find a package configuration file provided by "FindLibXml2" with any of the following names:
FindLibXml2Config.cmake findlibxml2-config.cmake
Add the installation prefix of "FindLibXml2" to CMAKE_PREFIX_PATH or set "FindLibXml2_DIR" to a directory containing one of the above files. If "FindLibXml2" provides a separate development package or SDK, be sure it has been installed.
为什么要查找这个 -config
文件?我做错了什么?
CMake 片段
find_package(FindLibXml2 CONFIG REQUIRED)
我也试过了
find_package(FindLibXml2 REQUIRED)
不确定使用哪一个
你不应该在 FindLibXml2
中有 Find
;做:
find_package(LibXml2 REQUIRED)
如 documentation 中所述:
CMake searches for a file called
Find<package>.cmake