pugixml 包含目录设置为未从 pugixml 配置 cmake 文件中找到

pugixml include dir set to not found from pugixml config cmake files

我正在尝试从源代码编译这个项目:https://github.com/computationalpathologygroup/ASAP.git。 Pugixml 是一个依赖项

我已经从源代码构建了 pugixml 并设置了 PugiXML_DIR 和 PUGIXML_INCLUDE_DIR 但它仍然给我错误:"CMake Error: The following variables are used in this project, but they are set to NOTFOUND."

我尝试过的东西:

这是我得到的错误:

CMake Error: The following variables are used in this project, but they are set to NOTFOUND.
Please set them or make sure they are set and tested correctly in the CMake files:
cpp/ASAP/annotation/PUGIXML_INCLUDE_DIR
   used as include directory in directory 
/cpp/ASAP/annotation
cpp/ASAP/multiresolutionimageinterface/PUGIXML_INCLUDE_DIR
   used as include directory in directory cpp/ASAP/multiresolutionimageinterface

其他信息:设置PugiXML_DIR是必须的,cmake会在该目录中查找名为"pugixml-config.cmake"的文件。并且配置 cmake 文件应该指向已编译的 lib 文件。但是当它找不到时,我只是将编译的lib文件复制到pugixml-config.cmake指向的位置。

在 4.04.2019 之前的 ASAP 版本中,他们玩肮脏的游戏,从 IMPORTED 目标中提取包含目录。 annotation/CMakeLists.txt:30:

get_target_property(PUGIXML_INCLUDE_DIR pugixml INTERFACE_INCLUDE_DIRECTORIES)

在某些情况下,这会导致将 PUGIXML_INCLUDE_DIR 变量设置为“-NOTFOUND”,因此您会从 CMake 收到相应的错误消息。

在提交 36d8bd75 中,他们添加了 FindPugiXML.cmake 脚本,该脚本处理 find_package(PugiXML) 调用而不是 PugiXML 附带的配置脚本。在该查找脚本中,他们获得了带有 find_path 的包含目录,该目录看起来更自然:

find_path(PugiXML_INCLUDE_DIR pugixml.hpp)

因为在较新的 ASAP 版本中,不再使用与 PugiXML 一起提供的配置脚本 (pugixml-config.cmake),因此无法使用 PugiXML_DIRPugiXML_ROOT 提示 PugiXML 的位置。如果 PugiXML 安装到非系统默认位置,可以简单地将 PugiXML_INCLUDE_DIR 变量设置为 PugiXML 包含目录。