【问题标题】:Can't find Boost building CGAL example找不到 Boost 构建 CGAL 示例
【发布时间】:2013-11-12 05:55:55
【问题描述】:

我正在尝试构建一个 CGAL 附带的特定示例,但由于某种原因它无法找到 BOOST。 我以类似的方式成功编译了 CGAL 本身。 我关注了this guide on how to build it on windows

我确定 BOOST_ROOT 环境变量设置正确。

Edit2:我使用给定的 Core 示例脚本重新创建了 cmake 文件,如下所示。

光盘温度

cgal_create_CMakeLists -s delunay

在 cmake UI 中,我设置 Boost_DEBUG=ON 并配置。

我得到如下错误(我已经删除了不相关的部分):

cmake-2.8/Modules/FindBoost.cmake:476 ] _boost_TEST_VERSIONS = 1.56.1;/* ... omitted*/
cmake-2.8/Modules/FindBoost.cmake:478 ] Boost_USE_MULTITHREADED = TRUE
cmake-2.8/Modules/FindBoost.cmake:480 ] Boost_USE_STATIC_LIBS = OFF
cmake-2.8/Modules/FindBoost.cmake:482 ] Boost_USE_STATIC_RUNTIME = 
cmake-2.8/Modules/FindBoost.cmake:484 ] Boost_ADDITIONAL_VERSIONS = 1.56.1; /*... omitted*/
cmake-2.8/Modules/FindBoost.cmake:486 ] Boost_NO_SYSTEM_PATHS = 
cmake-2.8/Modules/FindBoost.cmake:538 ] Declared as CMake or Environmental Variables:
cmake-2.8/Modules/FindBoost.cmake:540 ]   BOOST_ROOT = 
cmake-2.8/Modules/FindBoost.cmake:542 ]   BOOST_INCLUDEDIR = 
cmake-2.8/Modules/FindBoost.cmake:544 ]   BOOST_LIBRARYDIR = 
cmake-2.8/Modules/FindBoost.cmake:546 ] _boost_TEST_VERSIONS = 1.56.1;1.56.0; /*... omitted*/
cmake-2.8/Modules/FindBoost.cmake:639 ] location of version.hpp: D:/dev/boost_1_54_0/boost/version.hpp
cmake-2.8/Modules/FindBoost.cmake:663 ] version.hpp reveals boost 1.54.0
cmake-2.8/Modules/FindBoost.cmake:739 ] guessed _boost_COMPILER = -vc110
cmake-2.8/Modules/FindBoost.cmake:749 ] _boost_MULTITHREADED = -mt
cmake-2.8/Modules/FindBoost.cmake:792 ] _boost_RELEASE_ABI_TAG = -
cmake-2.8/Modules/FindBoost.cmake:794 ] _boost_DEBUG_ABI_TAG = -gd
cmake-2.8/Modules/FindBoost.cmake:842 ] _boost_LIBRARY_SEARCH_DIRS = D:/dev/boost_1_54_0/lib32-msvc-11.0;D:/dev/boost_1_54_0/lib;D:/dev/boost_1_54_0/stage/lib;D:/dev/boost_1_54_0/lib;D:/dev/boost_1_54_0/../lib;D:/dev/boost_1_54_0/stage/lib;PATHS;C:/boost/lib;C:/boost;/sw/local/lib
cmake-2.8/Modules/FindBoost.cmake:1017 ] Boost_FOUND = 1
Boost version: 1.54.0
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:
Boost_INCLUDE_DIR (ADVANCED)
   used as include directory in directory D:/dev/CGAL-4.3/scripts/temp

Configuring incomplete, errors occurred!
See also "D:/dev/CGAL-4.3/scripts/temp/build/CMakeFiles/CMakeOutput.log".

Core 生成的 cmake 文件:

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

project( delaunay )


cmake_minimum_required(VERSION 2.6.2)
if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}" VERSION_GREATER 2.6)
  if("${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}.${CMAKE_PATCH_VERSION}" VERSION_GREATER 2.8.3)
    cmake_policy(VERSION 2.8.4)
  else()
    cmake_policy(VERSION 2.6)
  endif()
endif()

set( CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS true )
 
if ( COMMAND cmake_policy )

  cmake_policy( SET CMP0003 NEW )  

endif()

# 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()

# include helper file
include( ${CGAL_USE_FILE} )


# 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 for local package
include_directories( BEFORE ../include )


# Creating entries for target: delaunay
# ############################

add_executable( delaunay  delaunay.cpp )

add_to_cached_list( CGAL_EXECUTABLE_TARGETS delaunay )

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

有人知道可能是什么问题吗?

【问题讨论】:

  • 我建议您创建一个名为“Boost_DEBUG”的 CMake 布尔变量并将其设置为“ON”,然后重新配置。该变量将使 FindBoost 脚本更加冗长。请复制新的 CMake 输出。
  • 嘿,谢谢你看,请看我上面的编辑。
  • 您应该在include_directories 通话中使用${Boost_INCLUDE_DIRS} 而不是${Boost_INCLUDE_DIR}。请参阅docs for FindBoost 了解更多信息。

标签: boost cmake cgal


【解决方案1】:

确实,CMakeLists.txt 不会尝试查找 Boost 库和头文件。这就是Boost_DEBUG 变量无效的原因。 CGAL 库配置似乎不正确。您应该在 CGAL 库的构建目录中重新运行 CMake,并检查是否没有错误。

【讨论】:

  • 查看我的编辑。我重新生成了我认为现在看起来正确的 cmake 文件。但我遇到了一个稍微不同的问题。
  • 我不确定你做了什么。我告诉过你,你应该自己重新配置和重新构建 CGAL 库。 D:/dev/CGAL-4.3/scripts/temp/build 是 CGAL 库的构建目录还是一个特殊示例? D:/dev/CGAL-4.3/scripts/temp/build/CMakeCache.txtCMAKE_SOURCE_DIR的值是多少?
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2011-04-22
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2022-01-22
  • 1970-01-01
相关资源
最近更新 更多