【发布时间】:2020-01-13 11:52:38
【问题描述】:
我在 ubuntu 18.04 LTS 上通过包管理器安装了 CGAL。然后如https://doc.cgal.org/latest/Manual/usage.html 所述,以编译示例程序。当我发布时:
cmake -DCMAKE_BUILD_TYPE=Release .
要配置示例,我收到以下错误:
CMake Error at CMakeLists.txt:29 (create_single_source_cgal_program):
Unknown CMake command "create_single_source_cgal_program".
-- Configuring incomplete, errors occurred!
请帮助;我该怎么办?
CmakeLists.txt
# Created by the script cgal_create_cmake_script
# This is the CMake script for compiling a CGAL application.
cmake_minimum_required(VERSION 3.1...3.15)
project( Triangulation_2_Examples )
if(NOT POLICY CMP0070 AND POLICY CMP0053)
# Only set CMP0053 to OLD with CMake<3.10, otherwise there is a warning.
cmake_policy(SET CMP0053 OLD)
endif()
if(POLICY CMP0071)
cmake_policy(SET CMP0071 NEW)
endif()
find_package(CGAL COMPONENTS Qt5)
if(CGAL_Qt5_FOUND)
add_definitions(-DCGAL_USE_BASIC_VIEWER -DQT_NO_KEYWORDS)
endif()
if ( CGAL_FOUND )
# create a target per cppfile
file(GLOB cppfiles RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/*.cpp)
foreach(cppfile ${cppfiles})
create_single_source_cgal_program( "${cppfile}" )
endforeach()
if(CGAL_Qt5_FOUND)
target_link_libraries(draw_triangulation_2 PUBLIC CGAL::CGAL_Qt5)
else()
message(STATUS "NOTICE: The example draw_triangulation_2 requires Qt and will not be compiled.")
endif()
else()
message(STATUS "This program requires the CGAL library, and will not be compiled.")
endif()
【问题讨论】:
-
您使用的是 CGAL 示例中的 cmake 脚本还是您编写的脚本?还要确保有
find_library(CGAL)和if (CGAL_FOUND)。 -
这是 CMake 发出的第一个错误吗?在此之前可能有一个可以解释第二个错误。
-
@sloriot 我现在只是想运行 CGAL 示例...我没有写任何东西...我也附上了 CMakeLists.txt 文件...请检查。
-
@Irineau 不,这不是第一个错误......它显示了一些丢失的包,但是在安装了相应的包之后......只剩下这个错误
-
你从哪里得到的例子?您是否安装了 libcgal-demo,或者您是否下载了 CGAL-5.0 并查看了那些示例(与您安装的 CGAL 版本不匹配)?
标签: geometry ubuntu-18.04 computational-geometry cgal