【发布时间】:2019-06-11 14:11:38
【问题描述】:
我正在使用 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)
【问题讨论】:
标签: dll deployment cmake shared-libraries cgal