curl / Mailing Lists / curl-library / Single Mail

curl-library

Re: CMake - How to best include libcurl

From: Nick Chambers via curl-library <curl-library_at_cool.haxx.se>
Date: Wed, 12 Jul 2017 15:24:56 +0000

On Wed, Jul 12, 2017 at 8:21 AM Noam Chitayat via curl-library <
curl-library_at_cool.haxx.se> wrote:

> Hey folks!
>
> For the past little while, I've had curl statically linked into a project.
> The project Makefile invokes the autoconf script in curl and produces a
> static library. I'm now switching to CMake, but running into problems.
>
> My CMakeLists.txt has the following commands:
>
> ```
> set(HTTP_ONLY ON)
> set(CMAKE_USE_OPENSSL OFF)
> set(BUILD_CURL_EXE OFF)
> set(CURL_STATICLIB ON)
> set(CURL_ZLIB OFF)
> set(CMAKE_USE_LIBSSH2 OFF)
>
> add_subdirectory(curl)
> ```
>

Correct me if I'm wrong (I'm on mobile and it's been a while since I've
done CMAKE), but isn't set used for internal CMAKE variables, not
preprocessor directives/configure switches?

> Unfortunately, even with these settings, I get the following
> OpenSSL-related error:
> ```
> CMake Error at
> /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:148
> (message):
> Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
> system variable OPENSSL_ROOT_DIR (missing: OPENSSL_INCLUDE_DIR)
> Call Stack (most recent call first):
>
> /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:388
> (_FPHSA_FAILURE_MESSAGE)
> /usr/local/Cellar/cmake/3.6.2/share/cmake/Modules/FindOpenSSL.cmake:380
> (find_package_handle_standard_args)
> curl/CMakeLists.txt:356 (find_package)
> ```
>
> I've clearly done something wrong here. Is there documentation or an
> example available of a CMakeLists.txt that includes curl as a subdirectory?
>
> Thanks so much for your help,
> Noam Chitayat
> -------------------------------------------------------------------
> Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
> Etiquette: https://curl.haxx.se/mail/etiquette.html

Nicholas Chambers

> <https://curl.haxx.se/mail/etiquette.html>

-------------------------------------------------------------------
Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library
Etiquette: https://curl.haxx.se/mail/etiquette.html
Received on 2017-07-12