Cmake找不到提升

CMake is not finding Boost

本文关键字:找不到 Cmake      更新时间:2023-10-16

我正在尝试安装CGAL。他们在第6.1节中描述了他们的安装过程。当我运行cmake-gui然后单击configure时,我将获得以下输出:

CMake Error at D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1192 (message):
  Unable to find the requested Boost libraries.
  Boost version: 1.51.0
  Boost include path: D:/program files/boost_1_51
  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:590 (include)

但i did 在CMAKE的GUI中设置了BOOST_ROOT,以D:/program files/boost_1_51的存在。而且,它提到的两个库肯定是安装的。这里发生了什么?我需要做什么?

附加是运行cmake -DBoost_DEBUG=ON时的输出:

D:program filesCGAL-4.1>cmake -DBoost_DEBUG=ON
== Setting paths ==
-- Build CGAL from release in directory CGAL-4.1
-- Packagenames: CGAL-4.1
== Setting paths (DONE) ==
== Generate version files ==
-- CGAL_MAJOR_VERSION=4
-- CGAL_MINOR_VERSION=1
-- CGAL_BUGFIX_VERSION=0
-- CGAL_SONAME_VERSION=10
-- CGAL_SOVERSION     =10.0.0
-- CGAL_REFERENCE_CACHE_DIR=
-- Building shared libraries
-- Targetting Visual Studio 10 Win64
-- Target build enviroment supports auto-linking
-- Using VC10 compiler.
-- Generator uses intermediate configuration directory: $(Configuration)
-- USING CMake version: 2.8.10
-- System: Windows
== Generate version files (DONE) ==
== Set up flags ==
-- Build type: Release
-- USING CXXFLAGS = ' /DWIN32 /D_WINDOWS /W3 /Zm1000 /GR /EHsc -D_CRT_SECURE_NO_
DEPRECATE -D_SCL_SECURE_NO_DEPRECATE -D_CRT_SECURE_NO_WARNINGS -D_SCL_SECURE_NO_
WARNINGS /fp:strict /fp:except- /MD /O2 /Ob2 /D NDEBUG'
-- USING LDFLAGS = ' /STACK:10000000 /machine:x64  /INCREMENTAL:NO'
== Set up flags (DONE) ==
== Detect external libraries ==
-- External libraries supported: GMP;MPFR;ZLIB;OpenGL;LEDA;MPFI;RS;RS3;OpenNL;TA
UCS;Eigen3;BLAS;LAPACK;QGLViewer;ESBTL;Coin3D;NTL;IPE
-- Preconfiguring library: GMP ...
-- GMP has been preconfigured:
--   CGAL_UseGMP-file:
--   GMP include:      D:/program files/CGAL-4.1/auxiliary/gmp/include
--   GMP libraries:    D:/program files/CGAL-4.1/auxiliary/gmp/lib/libgmp-10.lib
--   GMP definitions:
-- USING GMP_VERSION = '5.0.1'
-- Preconfiguring library: MPFR ...
-- MPFR has been preconfigured:
--   CGAL_UseMPFR-file:
--   MPFR include:      D:/program files/CGAL-4.1/auxiliary/gmp/include
--   MPFR libraries:    D:/program files/CGAL-4.1/auxiliary/gmp/lib/libmpfr-4.li
b
--   MPFR definitions:
-- USING MPFR_VERSION = '3.0.0'
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:566 ] _b
oost_TEST_VERSIONS = 1.56.1;1.56.0;1.56;1.55.1;1.55.0;1.55;1.54.1;1.54.0;1.54;1.
53.1;1.53.0;1.53;1.52.1;1.52.0;1.52;1.51.1;1.51.0;1.51;1.50.1;1.50.0;1.50;1.49.1
;1.49.0;1.49;1.48.1;1.48.0;1.48;1.47.1;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.1;1.4
5.0;1.45;1.44.1;1.44.0;1.44;1.43.1;1.43.0;1.43;1.42.1;1.42.0;1.42;1.41.1;1.41.0;
1.41;1.40.1;1.40.0;1.40;1.39.1;1.39.0;1.39;1.38.1;1.38.0;1.38;1.37.1;1.37.0;1.37
;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;
1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1
.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37
.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:568 ] Bo
ost_USE_MULTITHREADED = TRUE
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:570 ] Bo
ost_USE_STATIC_LIBS = OFF
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:572 ] Bo
ost_USE_STATIC_RUNTIME =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:574 ] Bo
ost_ADDITIONAL_VERSIONS = 1.56.1;1.56.0;1.56;1.55.1;1.55.0;1.55;1.54.1;1.54.0;1.
54;1.53.1;1.53.0;1.53;1.52.1;1.52.0;1.52;1.51.1;1.51.0;1.51;1.50.1;1.50.0;1.50;1
.49.1;1.49.0;1.49;1.48.1;1.48.0;1.48;1.47.1;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.
1;1.45.0;1.45;1.44.1;1.44.0;1.44;1.43.1;1.43.0;1.43;1.42.1;1.42.0;1.42;1.41.1;1.
41.0;1.41;1.40.1;1.40.0;1.40;1.39.1;1.39.0;1.39;1.38.1;1.38.0;1.38;1.37.1;1.37.0
;1.37
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:576 ] Bo
ost_NO_SYSTEM_PATHS =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:644 ] De
clared as CMake or Environmental Variables:
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:646 ]
BOOST_ROOT = D:/program files/boost_1_51/bin
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:648 ]
BOOST_INCLUDEDIR =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:650 ]
BOOST_LIBRARYDIR =
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:652 ] _b
oost_TEST_VERSIONS = 1.56.1;1.56.0;1.56;1.55.1;1.55.0;1.55;1.54.1;1.54.0;1.54;1.
53.1;1.53.0;1.53;1.52.1;1.52.0;1.52;1.51.1;1.51.0;1.51;1.50.1;1.50.0;1.50;1.49.1
;1.49.0;1.49;1.48.1;1.48.0;1.48;1.47.1;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.1;1.4
5.0;1.45;1.44.1;1.44.0;1.44;1.43.1;1.43.0;1.43;1.42.1;1.42.0;1.42;1.41.1;1.41.0;
1.41;1.40.1;1.40.0;1.40;1.39.1;1.39.0;1.39;1.38.1;1.38.0;1.38;1.37.1;1.37.0;1.37
;1.56.0;1.56;1.55.0;1.55;1.54.0;1.54;1.53.0;1.53;1.52.0;1.52;1.51.0;1.51;1.50.0;
1.50;1.49.0;1.49;1.48.0;1.48;1.47.0;1.47;1.46.1;1.46.0;1.46;1.45.0;1.45;1.44.0;1
.44;1.43.0;1.43;1.42.0;1.42;1.41.0;1.41;1.40.0;1.40;1.39.0;1.39;1.38.0;1.38;1.37
.0;1.37;1.36.1;1.36.0;1.36;1.35.1;1.35.0;1.35;1.34.1;1.34.0;1.34;1.33.1;1.33
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:734 ] lo
cation of version.hpp: D:/program files/boost_1_51/boost/version.hpp
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:754 ] ve
rsion.hpp reveals boost 1.51.0
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:786 ] gu
essed _boost_COMPILER = -vc100
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:796 ] _b
oost_MULTITHREADED = -mt
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:839 ] _b
oost_RELEASE_ABI_TAG = -
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:841 ] _b
oost_DEBUG_ABI_TAG = -gd
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:884 ] _b
oost_LIBRARY_SEARCH_DIRS = D:/program files/boost_1_51/bin/lib;D:/program files/
boost_1_51/bin/stage/lib;D:/program files/boost_1_51/lib;D:/program files/boost_
1_51/../lib;D:/program files/boost_1_51/stage/lib;C:/boost/lib;C:/boost;C:Progr
am Files (x86)/boost/boost_1_51_0/lib;C:Program Files (x86)/boost/boost_1_51/li
b;C:Program Files (x86)/boost/lib;C:Program Files (x86)/boost;/sw/local/lib
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:962 ] Se
arching for THREAD_LIBRARY_RELEASE: boost_thread-vc100-mt-1_51;boost_thread-vc10
0-mt;boost_thread-mt-1_51;boost_thread-mt;boost_thread
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:994 ] Se
arching for THREAD_LIBRARY_DEBUG: boost_thread-vc100-mt-gd-1_51;boost_thread-vc1
00-mt-gd;boost_thread-mt-gd-1_51;boost_thread-mt-gd;boost_thread-mt;boost_thread
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:962 ] Se
arching for SYSTEM_LIBRARY_RELEASE: boost_system-vc100-mt-1_51;boost_system-vc10
0-mt;boost_system-mt-1_51;boost_system-mt;boost_system
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:994 ] Se
arching for SYSTEM_LIBRARY_DEBUG: boost_system-vc100-mt-gd-1_51;boost_system-vc1
00-mt-gd;boost_system-mt-gd-1_51;boost_system-mt-gd;boost_system-mt;boost_system
-- [ D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmake:1108 ] B
oost_FOUND = FALSE
CMake Error at D:/program files/CMake 2.8/share/cmake-2.8/Modules/FindBoost.cmak
e:1192 (message):
  Unable to find the requested Boost libraries.
  Boost version: 1.51.0
  Boost include path: D:/program files/boost_1_51
  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:590 (include)

-- Boost include:     D:/program files/boost_1_51
-- Boost libraries:
-- Boost definitions:
-- USING BOOST_VERSION = '1.51.0'
== Detect external libraries (DONE) ==
== Write compiler_config.h ==
== Write compiler_config.h (DONE) ==
== Generating build files ==
Configuring libCGAL
-- Requested component: MPFR
-- Requested component: GMP
libCGAL is configured
-- Sources for CGAL component library 'Core' detected
Configuring libCGAL_Core
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_Core is configured
-- Sources for CGAL component library 'ImageIO' detected
Configuring libCGAL_ImageIO
-- 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: CGAL_ImageIO needs ZLib to read compressed files. That feature will n
ot be activated.
-- Sources for CGAL component library 'Qt3' detected
Configuring libCGAL_Qt3
-- CGAL_Qt3 needs Qt3, cannot be configured.
-- Sources for CGAL component library 'Qt4' detected
Configuring libCGAL_Qt4
-- USING OPENGL_VERSION = '1.1'
-- USING QT4_VERSION = '4.8.3'
-- OpenGL include:
-- OpenGL libraries:   glu32;opengl32
-- OpenGL definitions:
-- Qt4 include:        D:/QT/include
-- Qt4 libraries:      optimized;D:/QT/lib/qtmain.lib;debug;D:/QT/lib/qtmaind.li
b;optimized;D:/QT/lib/QtOpenGL4.lib;debug;D:/QT/lib/QtOpenGLd4.lib;optimized;D:/
QT/lib/QtGui4.lib;debug;D:/QT/lib/QtGuid4.lib;optimized;D:/QT/lib/QtCore4.lib;de
bug;D:/QT/lib/QtCored4.lib
-- Qt4 definitions:    -DQT_DLL
-- moc executable:     D:/QT/bin/moc.exe
-- uic executable:     D:/QT/bin/uic.exe
-- Requested component: MPFR
-- Requested component: GMP
libCGAL_Qt4 is configured
-- Sources for CGAL component libraries 'CGAL;Core;ImageIO;Qt3;Qt4' detected
== Generating build files (DONE) ==
-- Configuring incomplete, errors occurred!

(我至少看到了三个与这个问题相同的标题的问题。每个问题都有一个对OP有用的答案,但对我来说却不适用,所以我很抱歉重复这个问题...)

您的输出表明CMAKE正在以下位置搜索库:

D:/program files/boost_1_51/bin/lib
D:/program files/boost_1_51/bin/stage/lib
D:/program files/boost_1_51/lib
D:/program files/boost_1_51/../lib
D:/program files/boost_1_51/stage/lib
C:/boost/lib
C:/boost
C:Program Files (x86)/boost/boost_1_51_0/lib
C:Program Files (x86)/boost/boost_1_51/lib
C:Program Files (x86)/boost/lib
C:Program Files (x86)/boost
/sw/local/lib

它还表明,它期望库以某种方式命名。例如,boost.thread的发行版:

boost_thread-vc100-mt-1_51
boost_thread-vc100-mt
boost_thread-mt-1_51
boost_thread-mt
boost_thread

如果您的Boost库确实存在于一个搜索的位置中,那么问题可能是库的名称。您可以通过设置与Findboost模块相关的适当CMAKE变量来调整Boost库的预期名称。

例如,如果您使用 link=static threading=multi使用bjam构建了增强,则在cmakelists.txt中,在 find_package(Boost ...)之前

set(Boost_USE_STATIC_LIBS ON)
set(Boost_USE_MULTITHREADED ON)

或用-DBoost_USE_STATIC_LIBS=ON -DBoost_USE_MULTITHREADED=ON调用CMAKE。

正如@noam在下面的评论中指出的那样,在这种特殊情况下,CGAL似乎需要Boost库的共享(DLL)版本;在命令行上通过-DBoost_USE_STATIC_LIBS=ON没有任何效果。

我有一个错误,但是我已经进步了。

我正在使用CMAKE GUI,勾选了复选框"高级"(在复选框"分组"answers"按钮"添加输入"),然后勾选了新近看到的复选框" CGAL_BOOST_BOOstrongTATIC_STATIC_LIBS"。

您可能需要在显示额外选项之前按"配置"一两个时间。

今天,我尝试在Windows上安装以Boost 1.57 X64安装CGAL,并遇到了同样的问题。我通过预构建二进制文件和CMAKE搜索的.lib文件安装了Boost,该文件位于lib64-msvc-12.0文件夹中。

因此,将BOOST_LIBRARYDIR=.../boost_1_57_0/lib64-msvc-12.0添加到Cmake选项是我的解决方案。

您的系统(通过cmake)找不到辅助的静态库(.A文件)。因此,请尝试在系统中存在.A文件中存在的cmake文件中包含路径。例如,

set(BOOST_LIBRARYDIR {Path_here_to_boost_Static_libraries}).

这对我有用。

  1. cgal使用共享的boost库。因此,诸如" libboost_thread-vc100-mt-p-1_49.lib"之类的库是静态链接的库。

  2. 这是因为Cmake(我使用v2.8.9)无法正确读取Boost库的名称。当我更改库名时, boost_thread-vc100-mt-p-1_49.dll boost_thread-vc100-mt-vc100-mt-p-1_49.lib boost_thread-vc100-mt-1_49 ,它解决了问题。