CMake use specific Boost version

2019-08-30 08:36发布

I am working on a project where I am linking against a library which was itself linked against boost 1.48. I am looking for a way to specify in my CMakeLists.txt that I want the system to find and only use the boost 1.48 library.

I am not able to update the version the other library was compiled against and so I cannot set a minimum version number I need a way to set the only acceptable boost version. I have not been able to find a method to do this.

标签: boost cmake
1条回答
叼着烟拽天下
2楼-- · 2019-08-30 08:58

You should use find_package:

format is as follows:

 find_package(package version EXACT REQUIRED COMPONENTS components…) 

so if you need exactly 1.48 then you should use (example):

 find_package(Boost 1.48 EXACT REQUIRED COMPONENTS system thread date_time) 
查看更多
登录 后发表回答