Comments (8)
Perfect! Thanks for the feedback. Closing this one as complete.
from cpr.
@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.
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.
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.
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.
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.
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.
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)
- Failed to build with ndk HOT 7
- cpr::Download failed to decode downloaded content of gzip encoding HOT 4
- trying to use discord webhook api: St12length_error - basic_string::_M_create HOT 1
- CMake target exports are not created if not using system curl HOT 3
- Handling SSE HOT 3
- build error for android using cmake on macOS HOT 1
- HTTPS segmentation fault, but HTTP will not. HOT 2
- Link error when setting -DCMAKE_BUILD_TYPE=Debug HOT 4
- SetUrl() does not update new URLs properly within same Session() object HOT 1
- SSL certificate pinning HOT 3
- Question: Is `WriteCallback` asynchronous? HOT 1
- cpr::Buffer data lifetime question HOT 4
- constexpr methods for some string-like types HOT 1
- Add support for identifying whether a Session is currently busy or not HOT 1
- zlib ignores --prefix/CMAKE_INSTALL_PREFIX when using cpr as external dependency HOT 2
- Link error when creating a cpr::Header, segment fault when making cpr::Get request HOT 1
- Question: Does cpr support ftp? HOT 1
- Confused on something HOT 3
- Making multiple requests through a session uses response cookies on subsequent requests HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cpr.