Giter Club home page Giter Club logo

Comments (8)

COM8 avatar COM8 commented on June 14, 2024 1

Perfect! Thanks for the feedback. Closing this one as complete.

from cpr.

COM8 avatar COM8 commented on June 14, 2024

@Ace-Radom Thanks for taking the time to write such a detailed issue!

Do you need to compile your code as a shared executable BUILD_SHARED_LIBS=OFF?

Or does your use case allow for a static executable (BUILD_SHARED_LIBS=ON)?

from cpr.

Ace-Radom avatar Ace-Radom commented on June 14, 2024

Do you need to compile your code as a shared executable BUILD_SHARED_LIBS=OFF?

Or does your use case allow for a static executable (BUILD_SHARED_LIBS=ON)?

I'm not quite sure what do shared & static executable mean, but I set BUILD_SHARED_LIBS variable as ON in my project. But building cpr as a static lib is also allowed.

And btw, the problem with libssh is, not all of us (the developers) have this library on their working computer, and the link to this thing is kinda...an accident. This causes inconsistency in the develop environments, because some of the builds are linked to libssh2-1__.dll but some of them aren't. I want to disable the link to libssl because it seems that all things work fine without it, and it's always better to have less dependencies.

And also thx for the quick response xD

from cpr.

COM8 avatar COM8 commented on June 14, 2024

A bit of context:

  • BUILD_SHARED_LIBS=ON - builds the executable an libraries into separate files that get linked during application startup. Benefit: If multiple applications need the same lib, they share disk space and RAM.
  • BUILD_SHARED_LIBS=OFF - builds the executable and libraries into a single executable (file). Benefits: Single executable that might be a bit larger.

Other things you might want to look into is packaging. Or especially cpack and letting it export everything related as a single ZIP file. Then after extracting you can directly start executing since all libs are present.

To solve issues on Windows where not all libs are located inside the build directory, take a look at this example:
https://github.com/libcpr/example-cmake-fetch-content/blob/d99dfed29be9e1e3e9100b5b5abd714f701f7fbe/CMakeLists.txt#L25-L28

from cpr.

Ace-Radom avatar Ace-Radom commented on June 14, 2024

I digged into the CMakeLists in built-in curl and found the following codes:

#libSSH2
option(CURL_USE_LIBSSH2 "Use libSSH2" ON)
mark_as_advanced(CURL_USE_LIBSSH2)
set(USE_LIBSSH2 OFF)

if(CURL_USE_LIBSSH2)
  find_package(LibSSH2)
  if(LIBSSH2_FOUND)
    list(APPEND CURL_LIBS ${LIBSSH2_LIBRARY})
    list(APPEND CMAKE_REQUIRED_INCLUDES "${LIBSSH2_INCLUDE_DIR}")
    include_directories("${LIBSSH2_INCLUDE_DIR}")
    set(USE_LIBSSH2 ON)
  endif()
endif()

# libssh
option(CURL_USE_LIBSSH "Use libSSH" OFF)
mark_as_advanced(CURL_USE_LIBSSH)
if(NOT USE_LIBSSH2 AND CURL_USE_LIBSSH)
  find_package(libssh CONFIG)
  if(libssh_FOUND)
    message(STATUS "Found libssh ${libssh_VERSION}")
    # Use imported target for include and library paths.
    list(APPEND CURL_LIBS ssh)
    set(USE_LIBSSH ON)
  endif()
endif()

I found the location of this code in the curl repo here.

And therefore I added this two lines in my CMakeLists:

set(CURL_USE_LIBSSH2 OFF CACHE STRING "" FORCE)
set(CURL_USE_LIBSSH OFF CACHE STRING "" FORCE)

and after that cpr doesn't search for libssh anymore.

I'm testing it on my github workflows but I think it'll work.

from cpr.

Ace-Radom avatar Ace-Radom commented on June 14, 2024

A bit of context:

  • BUILD_SHARED_LIBS=ON - builds the executable an libraries into separate files that get linked during application startup. Benefit: If multiple applications need the same lib, they share disk space and RAM.
  • BUILD_SHARED_LIBS=OFF - builds the executable and libraries into a single executable (file). Benefits: Single executable that might be a bit larger.

Other things you might want to look into is packaging. Or especially cpack and letting it export everything related as a single ZIP file. Then after extracting you can directly start executing since all libs are present.

To solve issues on Windows where not all libs are located inside the build directory, take a look at this example: https://github.com/libcpr/example-cmake-fetch-content/blob/d99dfed29be9e1e3e9100b5b5abd714f701f7fbe/CMakeLists.txt#L25-L28

I see...I'll also pay attention to it.

from cpr.

COM8 avatar COM8 commented on June 14, 2024

I'm testing it on my github workflows but I think it'll work.

Let me know what comes out of it and if there are any side effects with it.

from cpr.

Ace-Radom avatar Ace-Radom commented on June 14, 2024

Oh yes it worked, curl doesn't search for libssh after setting these two variables anymore. And surely, it is not linked to libssh2-1__.dll

Let me know what comes out of it and if there are any side effects with it.

I didn't find any side effects up till now but I must say I didn't cover all situations. I'm only sure for one thing that CURL_USE_LIBSSH2=OFF does ignore libssh and the built-in curl can also be built without it, but I'm not sure if it will also disable some functions in curl and what will be disabled.

from cpr.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.