Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/cmake/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cmake 在测试中临时链接Boost库_Cmake - Fatal编程技术网

Cmake 在测试中临时链接Boost库

Cmake 在测试中临时链接Boost库,cmake,Cmake,我有一个CMakeLists.txt文件,其中包含一个简单的CHECK\u CXX\u SOURCE\u COMPILES测试。对于该测试,我需要在它链接时添加Boost库,但仅限于该测试。我已经检查过Boost库是否存在 能做到吗?我应该将${Boost\u LIBRARIES}添加到哪个变量?您要查找的变量是CMAKE\u REQUIRED\u LIBRARIES: list(APPEND CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES}) check_

我有一个
CMakeLists.txt
文件,其中包含一个简单的
CHECK\u CXX\u SOURCE\u COMPILES
测试。对于该测试,我需要在它链接时添加Boost库,但仅限于该测试。我已经检查过Boost库是否存在


能做到吗?我应该将
${Boost\u LIBRARIES}
添加到哪个变量?

您要查找的变量是
CMAKE\u REQUIRED\u LIBRARIES

list(APPEND CMAKE_REQUIRED_LIBRARIES ${Boost_LIBRARIES})
check_cxx_source_compiles("int main() { ... }" MY_CODE_COMPILES)