cpr
cpr copied to clipboard
Can't build target with CMake when cpr compiled to static library
Description
I compiled cpr statically as was explained in README
git clone https://github.com/libcpr/cpr.git
cd cpr && mkdir build && cd build
cmake .. -DCPR_USE_SYSTEM_CURL=ON -DBUILD_SHARED_LIBS=OFF
cmake --build . --parallel
sudo cmake --install .
And when i tried to build my program i had the following error in terminal
My cmakefile
And that problem was not occurred when i compiled cpr as a shared library
Example/How to Reproduce
Install cpr as a static library Add to cmakefile
find_package(cpr REQUIRED)
target_link_libraries(main PRIVATE cpr::cpr)
Possible Fix
I could fix it only when add next line to cmakefile
find_package(OpenSSL REQUIRED)
Where did you get it from?
GitHub (branch e.g. master)
Additional Context/Your Environment
- OS: Windows 11 (wsl 2 ubuntu 24.04)
- Version: 1.11.0
@Cornpop456
Without looking too deep into it, I guess our cpr-config.cmake is not correct. It perhaps should include the find_package(OpenSSL REQUIRED) if cpr was build with OpenSSL enabled.
Sadly I won't have too much time this week to further investigate this.