Setting up curl library path in cmake

后端 未结 3 1901
终归单人心
终归单人心 2020-12-31 06:07

I downloaded \"curl library\" for use with a third party application. When I run the included cmake file, I get the following error. Please help me. I appreciate it:

相关标签:
3条回答
  • 2020-12-31 06:28

    You should install the libcurl-dev pkg with the following cmd first:

    $ yum search libcurl
    
    Loading mirror speeds from cached hostfile
    ============================= N/S Matched: libcurl =============================
    libcurl-devel.i686 : Files needed for building applications with libcurl
    libcurl-devel.x86_64 : Files needed for building applications with libcurl
    curlftpfs.x86_64 : CurlFtpFS is a filesystem for accessing FTP hosts based on
                     : FUSE and libcurl
    curlpp.i686 : A C++ wrapper for libcURL
    curlpp.x86_64 : A C++ wrapper for libcURL
    libcurl.i686 : A library for getting files from web servers
    libcurl.x86_64 : A library for getting files from web servers
    perl-WWW-Curl.x86_64 : Perl extension interface for libcurl
    python-pycurl.x86_64 : A Python interface to libcurl
    rubygem-curb.x86_64 : Ruby libcurl bindings
    

    then install the available pkg

    sudu yum install libcurl-devel.x86_64
    
    0 讨论(0)
  • 2020-12-31 06:38

    I faced same problem and this SO question was one of top during my search. So I am giving solution that I found. Following cmake worked for me to use libcurl include in my code. Hope it will be usefull for someone.

    set(CURL_LIBRARY "-lcurl") 
    find_package(CURL REQUIRED) 
    add_executable (curl-demo convert.cpp)
    include_directories(${CURL_INCLUDE_DIR})
    target_link_libraries(curl-demo ${CURL_LIBRARIES})
    
    0 讨论(0)
  • 2020-12-31 06:43

    via pkgconfig

    include(FindPkgConfig)
    pkg_check_modules(CURL libcurl REQUIRED)
    include_directories(
      SYSTEM ${CURL_INCLUDE_DIRS}
    )
    target_link_libraries(YOURTARGETNAME
      ${CURL_LIBRARIES}
    )
    
    0 讨论(0)
提交回复
热议问题