find_package() doesn't detect boost on Windows Cmake

后端 未结 4 565
广开言路
广开言路 2020-12-23 15:21

I\'m using a windows system. I want to use the Boost library using CMake. I\'ve installed boost on C:\\boost_1_55_0\\ Here is my CMakeLists.txt file

set(Boos         


        
4条回答
  •  醉酒成梦
    2020-12-23 16:04

    I spent many hours on this issue and finally resolved it by using a few variables outlined in FindBoost manual here https://cmake.org/cmake/help/v3.0/module/FindBoost.html

    Following variables helped me:

    set (Boost_DETAILED_FAILURE_MSG ON)
    set (Boost_THREADAPI win32)
    set (BOOST_ROOT "/boost_1_40_0")
    set (Boost_LIBRARY_DIR  "/boost_1_40_0/lib")
    set (Boost_COMPILER "-vc")
    set (Boost_USE_STATIC_RUNTIME ON)  
    set (Boost_DEBUG ON)  #<---------- Real life saver
    

提交回复
热议问题