dmikushin / binance-cxx-api

Binance Bincoin Exchange C++ API
MIT License
64 stars 42 forks source link

Use standard curl, fix out-of-tree build #9

Closed Lekensteyn closed 4 years ago

Lekensteyn commented 4 years ago

MBEDTLS_LIBRARIES, etc. are supposed to be absolute paths. Otherwise the build would fail with:

CMake Error: install(EXPORT "CURLTargets" ...) includes target "libcurl" which requires target "mbedtls" that is not in any export set.
CMake Error: install(EXPORT "CURLTargets" ...) includes target "libcurl" which requires target "mbedx509" that is not in any export set.
CMake Error: install(EXPORT "CURLTargets" ...) includes target "libcurl" which requires target "mbedcrypto" that is not in any export set.

By using absolute paths, curl no longer has to be patched as is done in https://github.com/curl/curl/pull/5051

Fix the include dir for $builddir/ThirdParty/libwebsockets/lws_config.h

dmikushin commented 4 years ago

Gives:

CMake Error at /Users/marcusmae/binance/binance-cxx-api/build/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_FILE:mbedtls>

  No target "mbedtls"

CMake Error at /Users/marcusmae/binance/binance-cxx-api/build/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_FILE:mbedx509>

  No target "mbedx509"

CMake Error at /Users/marcusmae/binance/binance-cxx-api/build/CMakeFiles/CMakeTmp/CMakeLists.txt:15 (target_link_libraries):
  Error evaluating generator expression:

    $<TARGET_FILE:mbedcrypto>

  No target "mbedcrypto"

CMake Error at /usr/local/Cellar/cmake/3.16.4/share/cmake/Modules/CheckLibraryExists.cmake:67 (try_compile):
  Failed to generate test project build system.
Call Stack (most recent call first):
  ThirdParty/curl/CMake/Macros.cmake:9 (check_library_exists)
  ThirdParty/curl/CMakeLists.txt:459 (check_library_exists_concat)

-- Configuring incomplete, errors occurred!
Lekensteyn commented 4 years ago

It used to work for me on Arch Linux with CMake 3.16.5, but after clearing the build tree, it does not work. I'll try to come up with a fix. In any case, the idea of fixing the library config as opposed to patching curl is sound.

Lekensteyn commented 4 years ago

Fix: https://github.com/dmikushin/binance-cxx-api/pull/10