Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't build target with CMake when cpr compiled to static library #1126

Open
Cornpop456 opened this issue Oct 14, 2024 · 1 comment
Open

Comments

@Cornpop456
Copy link

Cornpop456 commented Oct 14, 2024

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

2024-10-14_18-47-51

My cmakefile
2024-10-14_18-48-28

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
@COM8
Copy link
Member

COM8 commented Oct 14, 2024

@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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants