2017-09-28 1 views
-1

Ich bin kein C++ Programmierer, habe erst vor einer Weile einen Kurs gemacht. Unter Verwendung von Homebrew installierte ich libbitcoin und hoffte, dass ich die Bibliothek referenzieren könnte, als ob ich in der Lage wäre, die Boost-Bibliotheken zu referenzieren. Ich habe auch festgestellt, dass es keine Links in/usr/local/bin zum Keller gibt. Ich denke, ich könnte es funktionieren lassen, indem ich die absoluten Pfade benutze, aber ich suche nach dem richtigen Weg, mit dieser Konstellation umzugehen, die ich gerade erwähnt habe.Benutze libbitcoin in CLion

Aktuelle CMake:

cmake_minimum_required(VERSION 2.8.4) 

project(cplusplus) 

message(STATUS "start running cmake...") 

find_package(boost 1.65.1 COMPONENTS system filesystem REQUIRED) 
find_package(libbitcoin 3.3.0 COMPONENTS system filesystem REQUIRED) 

message("system: ${CMAKE_SYSTEM_PREFIX_PATH}") 
find_library(LIB_BITCOIN libbitcoin) 
message("bitcoin: ${LIB_BITCOIN}") 

if(Boost_FOUND) 
    message(STATUS "Boost_INCLUDE_DIRS: ${Boost_INCLUDE_DIRS}") 
    message(STATUS "Boost_LIBRARIES: ${Boost_LIBRARIES}") 
    message(STATUS "Boost_VERSION: ${Boost_VERSION}") 
    include_directories(${Boost_INCLUDE_DIRS}) 
endif() 

add_executable(cplusplus main.cpp) 

if(Boost_FOUND) 
    target_link_libraries(cplusplus ${Boost_LIBRARIES}) 
endif() 

Derzeit erhalte ich diese Fehler:

/Applications/CLion.app/Contents/bin/cmake/bin/cmake -DCMAKE_BUILD_TYPE=Debug -G "CodeBlocks - Unix Makefiles" /Users/johndow/Documents/Workspace/bitcoin-code/cplusplus 
-- start running cmake... 
-- Boost version: 1.65.1 
CMake Error at CMakeLists.txt:8 (find_package): 
    By not providing "Findlibbitcoin.cmake" in CMAKE_MODULE_PATH this project 
    has asked CMake to find a package configuration file provided by 
    "libbitcoin", but CMake did not find one. 

    Could not find a package configuration file provided by "libbitcoin" 
    (requested version 3.3.0) with any of the following names: 

    libbitcoinConfig.cmake 
    libbitcoin-config.cmake 

    Add the installation prefix of "libbitcoin" to CMAKE_PREFIX_PATH or set 
    "libbitcoin_DIR" to a directory containing one of the above files. If 
    "libbitcoin" provides a separate development package or SDK, be sure it has 
    been installed. 


-- Configuring incomplete, errors occurred! 
See also "/Users/johndoe/Documents/Workspace/bitcoin-code/cplusplus/cmake-build-debug/CMakeFiles/CMakeOutput.log". 

[Finished] 

Antwort

0

Sie scheinen in Ihrem CMakeLists Datei libbitcoin Bibliothek Doppel Lookup zu haben. Sie werden zunächst für sie suchen nach:

find_package(libbitcoin ...) 

und dann durch

find_library(LIB_BITCOIN libbitcoin) 

Cmake ist nicht glücklich (wie Ihre Fehlermeldung sagt) mit dem find_package() Klausel als libbitcoin nicht cmake nicht bieten Konfiguration von selbst. Sie haben viele Möglichkeiten, wie man es beheben, nur zwei von ihnen:

  1. entfernen find_package() und nur find_library() verwenden, ich denke, das ist der einfachere Weg ist, und Ihr Projekt soll auf diese Weise arbeitet

  2. bieten Sie cmake Konfiguration für libbitcoin selbst an. Gute Einführung, wie man das macht, ist hier (und gut zu lesen): https://cmake.org/Wiki/CMake:How_To_Find_Libraries