包括CGAL共享库以部署CGAL程序

时间:2019-06-11 14:11:38

标签: dll deployment cmake shared-libraries cgal

我正在使用CGAL构建C ++程序,并且正在编写CMake安装规则来部署该程序,以便我可以对结果进行CPack,并且最终用户不必安装CGAL或使用其任何依赖项它。为了做到这一点,我需要包括每个共享库(Windows上的DLL等),但是我找不到让我这样做的CMake变量。我在CGAL仓库中四处搜寻,但没有运气。我尝试使用${CGAL_LIBRARIES},但是那些没有给出路径,而且看来${CGAL_LIBRARIES_DIRS}似乎不是问题。

我当前的CMakeLists是基于专用CGAL脚本生成的:

# Created by the script cgal_create_CMakeLists
# This is the CMake script for compiling a set of CGAL applications.

project( MeshCleaner )

cmake_minimum_required(VERSION 2.8.11)

set(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake)

# CGAL and its components
find_package( CGAL QUIET COMPONENTS  )

if ( NOT CGAL_FOUND )

  message(STATUS "This project requires the CGAL library, and will not be compiled.")
  return()  

endif()


# Boost and its components
find_package( Boost REQUIRED )

if ( NOT Boost_FOUND )

  message(STATUS "This project requires the Boost library, and will not be compiled.")

  return()  

endif()

# include for local directory
include_directories( BEFORE include )

# include for local package


# Creating entries for target: meshCleaner
# ############################

add_executable( ${PROJECT_NAME}  main.cpp )

add_to_cached_list( CGAL_EXECUTABLE_TARGETS ${PROJECT_NAME} )

# Link the executable to CGAL and third-party libraries
target_link_libraries(${PROJECT_NAME}   ${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES} )

install(TARGETS ${PROJECT_NAME} DESTINATION . COMPONENT Libraries)

message(${CGAL_LIBRARIES} ${CGAL_3RD_PARTY_LIBRARIES})

if(WIN32)
    set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
    include(InstallRequiredSystemLibraries)
endif()

include(${PROJECT_NAME}CPack)

1 个答案:

答案 0 :(得分:0)

解决此问题的最简单方法是将CGAL用作仅标头。请检查手册。这是the direct link to the installation manual of CGAL-4.14, section "Header-only with CMake Configuration".