2017-09-28 7 views
-1

저는 C++ 프로그래머가 아니며 한참 전에 코스를 만들었습니다. homebrew를 사용하여 libbitcoin을 설치했으며 boost 라이브러리를 참조 할 수있는 것처럼 라이브러리를 참조 할 수 있기를 바랍니다. 나는 또한 셀라에/usr/local/bin에 링크가 없다는 것을 깨달았다. 절대 경로를 사용하여 작동시킬 수 있다고 생각하지만 방금 언급 한이 별자리를 처리하는 올바른 방법을 찾고 있습니다.CLION에서 libbitcoin을 사용하십시오.

현재 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() 

현재 나는 이러한 오류를 얻을 :

/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] 

답변

0

당신은 당신의 CMakeLists 파일의 라이브러리를 libbitcoin에 대한 이중 조회를 갖고있는 것 같다. 먼저하여 찾고 있습니다 :

find_library(LIB_BITCOIN libbitcoin) 

Cmake에 의해 다음

find_package(libbitcoin ...) 

와 것은 libbitcoin에 의해 cmake 구성을 제공하지 않는 한 find_package() 절 (당신의 오류 메시지가 말한 것처럼) 행복하지 않다 그 자체. 당신은 그들 중 두, 그것을 해결하기 위해 몇 가지 방법이 있습니다 :

  1. 제거 find_package()하고, 나는이 간단한 방법이며 프로젝트가 이런 식으로

  2. 에게 일을해야한다고 생각) (단 find_library 사용

    은 libbitcoin에 대한 cmake 구성을 직접 제공합니다. 좋은 소개 방법은 여기에 있습니다 (어쨌든 읽기 좋습니다) : https://cmake.org/Wiki/CMake:How_To_Find_Libraries

관련 문제