CMake无法找到boost库(CGAL,Windows)

时间:2015-05-06 22:48:02

标签: c++ boost build cmake cgal

我看到了很多关于这个问题的相同问题。他们的答案都不适合我,我很害怕。

我试图安装CGAL。我按照following tutorial一步一步地描述了这个过程。唯一的区别是我使用CodeBlocks并且我已选择"指定本机编译器"并指出它们mingw32-gcc.exemingw32-g++.exe似乎很好。当我运行cmake-gui然后单击configure时,我得到以下输出,勾选了Advanced选项:

The CXX compiler identification is GNU 4.4.1
The C compiler identification is GNU 4.4.1
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe
Check for working CXX compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe
Check for working C compiler: E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-gcc.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
== Setting paths ==
Build CGAL from release in directory CGAL-4.6
Packagenames: CGAL-4.6
== Setting paths (DONE) ==

== Generate version files ==
CGAL_MAJOR_VERSION=4
CGAL_MINOR_VERSION=6
CGAL_BUGFIX_VERSION=0
CGAL_SONAME_VERSION=11
CGAL_SOVERSION     =11.0.0
CGAL_REFERENCE_CACHE_DIR=
Building shared libraries
Targetting MinGW Makefiles
Using E:/Program Files (x86)/CodeBlocks/MinGW/bin/mingw32-g++.exe compiler.
USING CMake version: 2.8.8
System: Windows
USING GCC_VERSION = '4.4.1'
Using gcc version 4 or later. Adding -frounding-math
== Generate version files (DONE) ==

== Set up flags ==
Build type: Release
USING CXXFLAGS = ' -frounding-math -O3 -DNDEBUG'
USING LDFLAGS = '  '
== Set up flags (DONE) ==

== Detect external libraries ==
External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
Preconfiguring library: GMP ...
Found GMP: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll  
GMP has been preconfigured:
  UseGMP-file:      
  GMP include:      e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include
  GMP libraries:    e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libgmp-10.dll
  GMP definitions:  
USING GMP_VERSION = '5.0.1'
Preconfiguring library: MPFR ...
Found MPFR: e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll  
MPFR has been preconfigured:
  UseMPFR-file:      
  MPFR include:      e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/include
  MPFR libraries:    e:/Users/Bombax/Cpp/Libraries/CGAL-4.6/auxiliary/gmp/lib/libmpfr-4.dll
  MPFR definitions:  
USING MPFR_VERSION = '3.0.0'
CMake Error at E:/Program Files (x86)/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1200 (message):
  Unable to find the requested Boost libraries.

  Boost version: 1.58.0

  Boost include path: e:/Users/Bombax/Cpp/Libraries/boost_1_58_0

  The following Boost libraries could not be found:

          boost_thread
          boost_system

  No Boost libraries were found.  You may need to set BOOST_LIBRARYDIR to the
  directory containing Boost libraries or BOOST_ROOT to the location of
  Boost.
Call Stack (most recent call first):
  cmake/modules/CGAL_SetupBoost.cmake:6 (find_package)
  cmake/modules/CGAL_SetupDependencies.cmake:85 (include)
  CMakeLists.txt:640 (include)


Boost include:     e:/Users/Bombax/Cpp/Libraries/boost_1_58_0
Boost libraries:   
Boost definitions: 
USING BOOST_VERSION = '1.58.0'
== Detect external libraries (DONE) ==

== Write compiler_config.h ==
Performing Test CGAL_CFG_BOOST_VARIANT_SWAP_BUG - Failed
Performing Test CGAL_CFG_DENORMALS_COMPILE_BUG - Success
Performing Test CGAL_CFG_FPU_ROUNDING_MODE_UNWINDING_VC_BUG - Success
Performing Test CGAL_CFG_IEEE_754_BUG - Success
Performing Test CGAL_CFG_ISTREAM_INT_BUG - Success
Performing Test CGAL_CFG_MATCHING_BUG_5 - Success
Performing Test CGAL_CFG_MATCHING_BUG_6 - Success
Performing Test CGAL_CFG_MATCHING_BUG_7 - Success
Performing Test CGAL_CFG_MATCHING_BUG_8 - Success
Performing Test CGAL_CFG_NESTED_CLASS_FRIEND_DECLARATION_BUG - Success
Performing Test CGAL_CFG_NO_LIMITS - Success
Performing Test CGAL_CFG_NO_NEXTAFTER - Success
Performing Test CGAL_CFG_NO_STL - Success
Performing Test CGAL_CFG_NO_WARNING_CPP_DIRECTIVE_BUG - Success
Performing Test CGAL_CFG_NUMERIC_LIMITS_BUG - Success
Performing Test CGAL_CFG_OUTOFLINE_MEMBER_DEFINITION_BUG - Success
Performing Test CGAL_CFG_TEMPLATE_IN_DEFAULT_PARAMETER_BUG - Success
Performing Test CGAL_CFG_TYPENAME_BEFORE_DEFAULT_ARGUMENT_BUG - Success
Performing Test CGAL_CFG_USING_BASE_MEMBER_BUG_2 - Success
== Write compiler_config.h (DONE) ==

== Generating build files ==
Configuring libCGAL
Requested component: MPFR
Requested component: GMP
libCGAL is configured
Sources for CGAL component library 'CGAL_Core' detected
Configuring libCGAL_Core
Requested component: MPFR
Requested component: GMP
libCGAL_Core is configured
Sources for CGAL component library 'CGAL_ImageIO' detected
Configuring libCGAL_ImageIO
Found OpenGL: opengl32  
Could NOT find ZLIB (missing:  ZLIB_LIBRARY ZLIB_INCLUDE_DIR) 
OpenGL include:     
OpenGL libraries:   glu32;opengl32
Requested component: MPFR
Requested component: GMP
libCGAL_ImageIO is configured
NOTICE: libCGAL_ImageIO needs ZLib to read compressed files. That feature will not be activated.
Sources for CGAL component library 'CGAL_Qt3' detected
Configuring libCGAL_Qt3
libCGAL_Qt3 needs Qt3, cannot be configured.
Sources for CGAL component library 'CGAL_Qt4' detected
Configuring libCGAL_Qt4
libCGAL_Qt4 needs Qt4, cannot be configured.
Sources for CGAL component libraries 'CGAL_Core;CGAL_ImageIO;CGAL_Qt3;CGAL_Qt4' detected
== Generating build files (DONE) ==

Configuring incomplete, errors occurred!

我确实将BOOST_ROOT设置为CMake的GUI中的PATH,并存在e:/Users/Bombax/Cpp/Libraries/boost_1_58_0。它提到的两个库肯定是安装好的。我注意到我的boost安装中没有明确的include文件夹(尽管它们是libs)。我已经尝试检查CGAL_Boost_USE_STATIC_LIBS选项但没有更好的结果。这里发生了什么?我需要做什么?

1 个答案:

答案 0 :(得分:2)

好吧,我终于把所有东西都拿到了我需要的状态。以下内容基本上是如何使用Code :: Blocks在Windows 7上获取所需的神奇libCGAL.dll和libCGAL.a(库文件)的描述。

  1. 我下载并安装了CMake。
  2. 我下载并安装了Boost 1.58.0,其中包含手册和GMP(但不是示例,因为我不想用Qt来解决)。目的地是一个没有空格的文件夹。
  3. 我下载并安装了CGAL-4.6。同样,目的地是没有空格的文件夹。
  4. 我将CodeBlocks \ MingW \ bin添加到我的PATH环境变量中。
  5. 我进入了boost_1_58_0文件夹,打开了一个命令提示符,然后键入bootstrap gcc,然后输入b2 --toolset=gcc,这一切都很好。这似乎将Boost构建到stage \ lib文件夹中。
  6. 我创建了一个新的Code :: Blocks项目来测试Boost文件。在项目构建选项中,我在链接器boost_1_58_0 \ stage \ lib文件夹下选择了在链接器设置下添加到libboost_regex-mgw44-mt-1_58.a的直接路径的根目录,在我编译的boost_1_58_0文件夹下的搜索目录下。然后,我成功编译并运行了示例正则表达式程序here(第6节)。
  7. 我进入了CGAL-4.6文件夹并打开了一个命令提示符。我输入了cmake-gui。我跟着this tutorial跟着这封信,除了我(我想)我选择"指定原生编译器"并将它们指向MingW文件夹中的mingw32-gcc.exemingw32-g++.exe(如果您已经将MingW \ bin添加到路径中,那么它可能与第一个选项一起使用,无论如何,稍后)
  8. 在正确配置和构建之后,创建了一个Code :: Blocks项目文件以及一个Makefile。 Code :: Blocks文件没用,也无法正确构建,因为它试图运行make.exe而不是mingw32-make.exe。我不知道如何解决这个问题,所以我只是转到我的Code :: Blocks文件夹,打开命令提示符并输入mingw32-make.exe -s -f <path-to-the-makefile> all。它没有问题。
  9. 最后,我做了一个测试项目。与步骤6中一样,我添加了来自Boost的所有非调试库(stage / lib中的blah-blah-NOT-d.a)和来自CGAL-4.6 \ lib的libCGAL.dll.a库。我还添加了步骤6中的Boost目录和CGAL-4.6 \ include目录。
  10. 超级终于,我编译了示例here没有问题。在运行之前。我不得不将CGAL-4.6 \ bin \ libCGAL.dll移动到exe文件夹中,即bin \ Debug。
  11. 现在它是完全正确的,是不是很好?!

    如果其他人卡住了这个问题,请抛出一条消息,我可以向你发送每个人想要的实际文件:libCGAL.dll,libCGAL.dll.a,所有Boost库文件和所有标题。