gpt4 book ai didi

linux - 如何列出系统上可用的 target_link_libraries?

转载 作者:太空宇宙 更新时间:2023-11-04 09:26:30 26 4
gpt4 key购买 nike

我正在尝试链接我的 CMakeLists.txt 中的 Curl 库,我知道我应该要求包添加可执行文件并链接库,但我不知道如何调用变量名称以及我应该在哪里查看对于他们,你知道我应该去哪里找吗?有没有办法列出系统中我可以添加到我的项目中的所有库?

这是我的 CMakeLists(愚蠢的)尝试:

cmake_minimum_required(VERSION 3.3)
project(RadekClientRecon)
find_package(OpenCV REQUIRED)
find_package(CURL REQUIRED)
link_directories(/usr/lib/)
set(SOURCE_FILES main.cpp HttpManager.cpp)
add_executable(RadekClientRecon ${SOURCE_FILES})
target_link_libraries(RadekClientRecon ${OpenCV_LIBS} ${CURL_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

如果有帮助,我已经在我的计算机中搜索了所有名为“curl”的文件,如果有自动方式,我也会使用 CLion。

rinaldi@rinaldi-home:~/Projects/radekrecon$ sudo find / -name "*curl*" 2> /dev/null 
/home/rinaldi/.atom/packages/atom-beautify/node_modules/jscs/lib/rules/disallow-curly-braces.js
/home/rinaldi/.atom/packages/atom-beautify/node_modules/jscs/lib/rules/require-curly-braces.js
/var/lib/dpkg/info/libcurl3:amd64.list
/var/lib/dpkg/info/python3-pycurl.md5sums
/var/lib/dpkg/info/libcurl3-gnutls:amd64.shlibs
/var/lib/dpkg/info/curl.md5sums
/var/lib/dpkg/info/libcurl3:amd64.postrm
/var/lib/dpkg/info/libcurl3:amd64.md5sums
/var/lib/dpkg/info/python3-pycurl.list
/var/lib/dpkg/info/libcurl3-gnutls:amd64.symbols
/var/lib/dpkg/info/libcurl3-gnutls:amd64.postrm
/var/lib/dpkg/info/libcurl3:amd64.symbols
/var/lib/dpkg/info/libcurl3-gnutls:amd64.md5sums
/var/lib/dpkg/info/libcurl3:amd64.postinst
/var/lib/dpkg/info/libcurl3:amd64.shlibs
/var/lib/dpkg/info/python3-pycurl.postinst
/var/lib/dpkg/info/curl.list
/var/lib/dpkg/info/python3-pycurl.prerm
/var/lib/dpkg/info/libcurl3-gnutls:amd64.postinst
/var/lib/dpkg/info/libcurl3-gnutls:amd64.list
/opt/clion-1.2.4/bin/cmake/doc/cmake-3.3/cmcurl
/opt/clion-1.2.4/bin/gdb/lib/python2.7/macurl2path.py
/usr/lib/python2.7/macurl2path.py
/usr/lib/python3.5/macurl2path.py
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4
/usr/lib/x86_64-linux-gnu/libcurl.so.4
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.3
/usr/lib/x86_64-linux-gnu/libcurl.so.3
/usr/lib/x86_64-linux-gnu/libcurl-gnutls.so.4.3.0
/usr/lib/x86_64-linux-gnu/gstreamer-0.10/libgstcurl.so
/usr/lib/x86_64-linux-gnu/libcurl.so.4.3.0
/usr/lib/python3/dist-packages/pycurl.cpython-35m-x86_64-linux-gnu.so
/usr/lib/python3/dist-packages/curl
/usr/lib/python3/dist-packages/pycurl-7.19.5.1.egg-info
/usr/lib/python3/dist-packages/pycurl.cpython-34m-x86_64-linux-gnu.so
/usr/lib/python3.4/macurl2path.py
/usr/lib/gnupg/gpgkeys_curl
/usr/bin/curl
/usr/share/man/man1/curl.1.gz
/usr/share/lintian/overrides/libcurl3
/usr/share/lintian/overrides/libcurl3-gnutls
/usr/share/doc/libcurl3
/usr/share/doc/python3-pycurl
/usr/share/doc/libcurl3-gnutls
/usr/share/doc/curl
/usr/share/bash-completion/completions/curl

最佳答案

显然我需要安装 curl 以外的一些包。

 * libcurl4-gnutls-dev
* libcurl4-nss-dev
* libcurl4-openssl-dev

这些变量以可以找到的模块命名 here .我的 CMakeList.txt 现在正在创建正确的 make 文件,如下所示:

cmake_minimum_required(VERSION 3.3)
project(RadekClientRecon)
find_package(OpenCV REQUIRED)
find_package(CURL REQUIRED)
link_directories(/usr/lib/)
link_directories(CURL_INCLUDE_DIRS)
set(SOURCE_FILES main.cpp HttpManager.cpp)
add_executable(RadekClientRecon ${SOURCE_FILES})
target_link_libraries(RadekClientRecon ${OpenCV_LIBS} ${CURL_LIBRARIES})
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

关于linux - 如何列出系统上可用的 target_link_libraries?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35799319/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com