Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/141.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无法链接外部库 我有一个包含源文件的C++项目。对于外部项目,我需要搜索一些文件夹以查找包含的库: /home/data/lib/wisenet /home/data/lib/wise_log /home/data/lib/wise_rs_device /home/data/lib/json /home/data/lib/wise_versioning add_library(wise_rs_device STATIC IMPORTED GLOBAL) set_target_properties(wise_rs_device PROPERTIES IMPORTED_LOCATION "path/to/static/library" INTERFACE_INCLUDE_DIRECTORIES "path/to/headers/of/wise_rs_device" )_C++_Cmake - Fatal编程技术网

CMake无法链接外部库 我有一个包含源文件的C++项目。对于外部项目,我需要搜索一些文件夹以查找包含的库: /home/data/lib/wisenet /home/data/lib/wise_log /home/data/lib/wise_rs_device /home/data/lib/json /home/data/lib/wise_versioning add_library(wise_rs_device STATIC IMPORTED GLOBAL) set_target_properties(wise_rs_device PROPERTIES IMPORTED_LOCATION "path/to/static/library" INTERFACE_INCLUDE_DIRECTORIES "path/to/headers/of/wise_rs_device" )

CMake无法链接外部库 我有一个包含源文件的C++项目。对于外部项目,我需要搜索一些文件夹以查找包含的库: /home/data/lib/wisenet /home/data/lib/wise_log /home/data/lib/wise_rs_device /home/data/lib/json /home/data/lib/wise_versioning add_library(wise_rs_device STATIC IMPORTED GLOBAL) set_target_properties(wise_rs_device PROPERTIES IMPORTED_LOCATION "path/to/static/library" INTERFACE_INCLUDE_DIRECTORIES "path/to/headers/of/wise_rs_device" ),c++,cmake,C++,Cmake,我必须写些什么才能在CMake中包含这些外部库?这些文件夹仅包含接口资源h文件和.a库 我试图像这样包括这些目录: include_directories( /home/data/lib/wisenet /home/data/lib/wise_log ... etc ) 我不知道如何正确添加libwise_rs_device.a之类的lib文件。包含目录仅用于。。。好的,包括代码的路径。它不会链接库 使用外部库的正确方法是使用导入的库: /home/data/lib/w

我必须写些什么才能在CMake中包含这些外部库?这些文件夹仅包含接口资源h文件和.a库

我试图像这样包括这些目录:

include_directories(
    /home/data/lib/wisenet
    /home/data/lib/wise_log
    ... etc
)

我不知道如何正确添加libwise_rs_device.a之类的lib文件。

包含目录仅用于。。。好的,包括代码的路径。它不会链接库

使用外部库的正确方法是使用导入的库:

/home/data/lib/wisenet
/home/data/lib/wise_log
/home/data/lib/wise_rs_device
/home/data/lib/json
/home/data/lib/wise_versioning
add_library(wise_rs_device STATIC IMPORTED GLOBAL)
set_target_properties(wise_rs_device PROPERTIES
    IMPORTED_LOCATION "path/to/static/library"
    INTERFACE_INCLUDE_DIRECTORIES "path/to/headers/of/wise_rs_device"
)
然后,您可以简单地将导入的目标链接到您的目标:

# will link to the static library and add include directories.
target_link_libraries(your_executable PRIVATE wise_rs_device)

包含目录仅用于。。。好的,包括代码的路径。它不会链接库

使用外部库的正确方法是使用导入的库:

/home/data/lib/wisenet
/home/data/lib/wise_log
/home/data/lib/wise_rs_device
/home/data/lib/json
/home/data/lib/wise_versioning
add_library(wise_rs_device STATIC IMPORTED GLOBAL)
set_target_properties(wise_rs_device PROPERTIES
    IMPORTED_LOCATION "path/to/static/library"
    INTERFACE_INCLUDE_DIRECTORIES "path/to/headers/of/wise_rs_device"
)
然后,您可以简单地将导入的目标链接到您的目标:

# will link to the static library and add include directories.
target_link_libraries(your_executable PRIVATE wise_rs_device)