我正在尝试从源代码编译此项目:https://github.com/computationalpathologygroup/ASAP.git。 Pugixml是一个依赖项
我已经从源代码构建了pugixml并设置了PugiXML_DIR和PUGIXML_INCLUDE_DIR,但仍然给我一个错误:“ CMake错误:此项目中使用了以下变量,但它们设置为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指向的位置。
答案 0 :(得分:1)
在4.04.2019之前的ASAP版本中,他们通过从IMPORTED目标中提取include目录来玩肮脏的游戏。 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_DIR
或PugiXML_ROOT
来提示PugiXML的位置。如果PugiXML安装在非系统默认位置,则可以简单地将PugiXML_INCLUDE_DIR
变量设置为PugiXML包含目录。