我是CentOS 6服务器的用户,管理员很好地在它上安装了CGAL。首先,我将描述我的本地机器上的CMakeLists.txt,它的所有功能都是正常的,然后我的问题是为什么在服务器上同样不能工作。在我的笔记本电脑上,我有一个使用EMST示例8cpp-example.html的项目。“最外层”CMakeLists.txt具有find_package(CGAL),而特定的CMakeLists.txt具有以下内容:
add_executable(emst emst.cpp)
target_compile_options(emst BEFORE PUBLIC -mcmodel=large PRIVATE -pg -g -O2)
target_link_libraries(emst CGAL::CGAL)整个事情“在我的机器上工作”(C)。通常,在项目的构建目录中,我会发出cmake ../,然后在emst特定的子目录make emst中发出(当然,所有这些都是通过在CLion内部进行适当的单击来完成的)。现在,这个设置在服务器上不起作用。我得到了这样的错误:
/emst.cpp:99:44: error: no matching function for call to ‘source(edge_descriptor&, Triangulation&)’
vertex_descriptor svd = source(ed,t);
^
In file included from /usr/include/CGAL/boost/graph/graph_traits_Delaunay_triangulation_2.h:25:0,行政当局告诉我:
库可以在/usr/lib64 64中找到,在/usr/include/CGAL中可以找到头文件。
在某个时候,在服务器上的cmake ../-phase期间,我收到如下消息:
CMake警告(dev)在utils/CMakeLists.txt:31 (add_executable): 未设置策略CMP0028 :目标名称中的双冒号表示别名或导入的目标。运行"cmake --help-policy CMP0028“以获取策略细节。使用cmake_policy命令设置策略并取消此警告。 目标"emst“链接到目标"CGAL::CGAL”,但没有找到目标。也许导入的目标缺少了find_package()调用,或者缺少了别名目标?此警告是针对项目开发人员的。使用-Wno-dev来抑制它。
我尝试了find_package(CGAL REQUIRED),以便它抛出一个错误,如果找不到。似乎找到了这个包。这里会出什么问题?
发布于 2019-04-07 15:33:30
根据我使用CGAL的经验,您需要包含use文件:include(${CGAL_USE_FILE}),然后您可以根据需要使用目标。根据输出消息,似乎没有找到CGAL,因为目标CGAL::CGAL不存在。
所以基本上你需要:
find_package(CGAL)
# .. other code
include(${CGAL_USE_FILE})
add_executable(myexe ...)
target_link_libraries(myexe
PUBLIC
CGAL::CGAL
CGAL::CGAL_Core # and so on...
)https://stackoverflow.com/questions/55554085
复制相似问题