CMake:它怎么能找到 Boost 而找不到 Boost?

CMake: how can it find Boost AND not find Boost?

我的 cmake .. 能够同时找到 Boost 和找不到 Boost。这怎么可能?我怎样才能让它找到第二个 <== 箭头输出的提升?

这是我的 cmake .. Caffe 编译输出(查看 <== 箭头):

Tams-MacBook-Pro:build tamtran$ cmake ..
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode833.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode833.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode833.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode833.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE  
-- Boost version: 1.68.0 <<==========!!==LOOK HERE(1/2)==!!=====================
-- Found the following Boost libraries:
--   system
--   thread
--   filesystem
--   chrono
--   date_time
--   atomic
-- Found GFlags: /usr/local/include  
-- Found gflags  (include: /usr/local/include, library: /usr/local/lib/libgflags.dylib)
-- Found Glog: /usr/local/include  
-- Found glog    (include: /usr/local/include, library: /usr/local/lib/libglog.dylib)
-- Found Protobuf: /usr/local/lib/libprotobuf.dylib (found version "3.6.1") 
-- Found PROTOBUF Compiler: /usr/local/bin/protoc
-- HDF5: Using hdf5 compiler wrapper to determine C configuration
-- HDF5: Using hdf5 compiler wrapper to determine CXX configuration
-- Found HDF5: /usr/local/Cellar/hdf5/1.10.4/lib/libhdf5_cpp.dylib;/usr/local/Cellar/hdf5/1.10.4/lib/libhdf5.dylib;/usr/local/opt/szip/lib/libsz.dylib;/usr/lib/libz.dylib;/usr/lib/libdl.dylib;/usr/lib/libm.dylib (found version "1.10.4") found components:  HL 
-- Found LMDB: /usr/local/include  
-- Found lmdb    (include: /usr/local/include, library: /usr/local/lib/liblmdb.dylib)
-- Found LevelDB: /usr/local/include  
-- Found LevelDB (include: /usr/local/include, library: /usr/local/lib/libleveldb.dylib)
-- Found Snappy: /usr/local/include  
-- Found Snappy  (include: /usr/local/include, library: /usr/local/lib/libsnappy.dylib)
-- -- CUDA is disabled. Building without it...
-- OpenCV found (/usr/local/share/OpenCV)
-- Found vecLib: /System/Library/Frameworks/Accelerate.framework/Versions/Current/Frameworks/vecLib.framework/Versions/Current/Headers  
-- Found vecLib as part of Accelerate.framework
-- Found PythonInterp: /usr/local/bin/python2.7 (found suitable version "2.7.15", minimum required is "2.7") 
-- Found PythonLibs: /usr/lib/libpython2.7.dylib (found suitable version "2.7.10", minimum required is "2.7") 
-- Found NumPy: /usr/local/lib/python2.7/site-packages/numpy/core/include (found suitable version "1.15.4", minimum required is "1.7.1") 
-- NumPy ver. 1.15.4 found (include: /usr/local/lib/python2.7/site-packages/numpy/core/include)
-- Could NOT find Boost <<==========!!==LOOK HERE(2/2)==!!===================
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE) 
-- Python interface is disabled or not all required dependencies found. Building without it...
-- Found Git: /usr/local/bin/git (found version "2.10.1") 
-- 
-- ******************* Caffe Configuration Summary *******************
-- General:
--   Version           :   1.0.0
--   Git               :   1.0-132-g99bd997-dirty
--   System            :   Darwin
--   C++ compiler      :   /Applications/Xcode833.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
--   Release CXX flags :   -O3 -DNDEBUG -std=c++11 -fPIC -Wall
--   Debug CXX flags   :   -g -std=c++11 -fPIC -Wall
--   Build type        :   Release
-- 
--   BUILD_SHARED_LIBS :   ON
--   BUILD_python      :   ON
--   BUILD_matlab      :   OFF
--   BUILD_docs        :   ON
--   CPU_ONLY          :   ON
--   USE_OPENCV        :   ON
--   USE_LEVELDB       :   ON
--   USE_LMDB          :   ON
--   USE_NCCL          :   OFF
--   ALLOW_LMDB_NOLOCK :   OFF
--   USE_HDF5          :   ON
-- 
-- Dependencies:
--   BLAS              :   Yes (vecLib)
--   Boost             :   Yes (ver. 1.68)
--   glog              :   Yes
--   gflags            :   Yes
--   protobuf          :   Yes (ver. 3.6.1)
--   lmdb              :   Yes (ver. 0.9.22)
--   LevelDB           :   Yes (ver. 1.20)
--   Snappy            :   Yes (ver. 1.1.7)
--   OpenCV            :   Yes (ver. 3.2.0)
--   CUDA              :   No
-- 
-- Documentaion:
--   Doxygen           :   No
--   config_file       :   
-- 
-- Install:
--   Install path      :   /Users/tamtran/InstalledStuff/caffe/build/install
-- 
-- Configuring done
CMake Error at CMakeLists.txt:107 (add_dependencies):
  The dependency target "pycaffe" of target "pytest" does not exist.


-- Generating done
-- Build files have been written to: /Users/tamtran/InstalledStuff/caffe/build

额外的问题:为什么 python 没有列为找到的 Boost 库的一部分,即使我也安装了 boost-python? boost 和 boost-python 都是通过 brew 安装的。

如果您查看 Caffe's CMake scripts,您会发现第二个 Boost 日志是在搜索 Boost-Python 时生成的,您可能会遗漏它。

编辑:至于为什么 Boost-Python 可能没有找到:一种可能是您为[=安装了Boost-Python 20=] 而不是 python2.7.