簡體   English   中英

CMake找不到提升

[英]CMake doesn't find boost

Windows7。64位。 CMake 2.8.10。

腳步:

cd C:\work\lib\boost_1_51_0-MT
bootstrap.bat
bjam --toolset=msvc-10.0 --variant=release --build-type=complete -j 4 --with-regex --with-test --with-filesystem --with-date_time --with-random --with-system --with-thread --with-program_options --with-chrono --with-math stage link=static threading=multi runtime-link=static
  • 命令:
set BOOST_ROOT=C:\work\lib\boost_1_51_0-MT
cmake M:\project

  Unable to find the requested Boost libraries.

  Boost version: 1.51.0

  Boost include path: C:/work/lib/boost_1_51_0-MT

  The following Boost libraries could not be found:

          boost_system
          boost_thread
          boost_random
          boost_chrono

  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.

M:\\ project \\ CMakeLists.txt包含:(我需要靜態鏈接boost)

...
set_property(GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS ON)
set(USE_STATIC_BOOST ON)
add_definitions(-DBOOST_THREAD_USE_LIB)
add_definitions(-DBOOST_ALL_NO_LIB)

find_package(Boost 1.48.0 COMPONENTS system thread random chrono REQUIRED)
...

此CMakeLists.txt很舊,可以在其他增強安裝上使用(由我(過去不是我做,但是我以前做過,但是收據遺失了))。

解決了

set(Boost_USE_STATIC_LIBS ON)

...現在CMake可以找到增強庫! 雖然我的“ set(USE_STATIC_BOOST ON)”必須具有相同的效果,但是並沒有...

解決了

set(Boost_USE_STATIC_LIBS ON)

...現在CMake可以找到增強庫! 雖然我的CMakeLists.txt已set(USE_STATIC_BOOST ON) ,它必須具有相同的效果,但是它沒有...

要使用set(Boost_USE_STATIC_LIBS OFF)您需要添加:

if( WIN32 )
  # Needed for boost to turn off autolinking for dynamic linking
  add_definitions( -DBOOST_ALL_NO_LIB )
endif()

有關更多信息,請參見: 在Windows上將Boost庫與Boost_USE_STATIC_LIB OFF鏈接

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM