【问题标题】:CMake Error at cmake/modules/Findasio.cmake:11 - Failed to locate ASIO dependencycmake/modules/Findasio.cmake:11 处的 CMake 错误 - 无法找到 ASIO 依赖项
【发布时间】:2017-10-22 17:19:34
【问题描述】:

我正在尝试在 Visual Studio 2015 项目中使用 restbed framework

我克隆了restbed repo:https://github.com/Corvusoft/restbed.git

为了创建一个 Visual Studio 项目文件,我正在使用当前的 cmake 3.8.1 版本

现在,当尝试使用 cmake 配置 restbed 时,我收到了这个错误:

  Copyright 2013-2017, Corvusoft Ltd, All Rights Reserved.
CMake Error at cmake/modules/Findasio.cmake:11 (message):
  Failed to locate ASIO dependency.
Call Stack (most recent call first):
  CMakeLists.txt:31 (find_package)

有没有办法解决这个 Asio 问题?

现在我正在尝试编译 Boost library 以查看在哪里可以找到这些 Asio 依赖项并将其添加到 Cmake。

restbed CMakeLists.txt 文件的内容:

line
26   #
27   # Dependencies
28   #
29   set( CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/cmake/modules" )
30 
31   find_package( asio REQUIRED )
32   include_directories( SYSTEM ${asio_INCLUDE} )

CMake(配置)输出:

The CXX compiler identification is MSVC 19.0.24215.1
Check for working CXX compiler: F:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/x86_amd64/cl.exe
Check for working CXX compiler: F:/Program Files (x86)/Microsoft Visual 
Studio 14.0/VC/bin/x86_amd64/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
   Copyright 2013-2017, Corvusoft Ltd, All Rights Reserved.
CMake Error at cmake/modules/Findasio.cmake:11 (message):
  Failed to locate ASIO dependency.
Call Stack (most recent call first):
  CMakeLists.txt:31 (find_package)

Configuring incomplete, errors occurred!
See also "C:/Users/xxx/Documents/Visual Studio 2015/Projects/thread_Native_Handle/resbed_windows/CMakeFiles/CMakeOutput.log".

【问题讨论】:

    标签: visual-studio-2015 cmake boost-asio restbed


    【解决方案1】:

    Asio(不要与 boost asio 混淆)在 restbed 存储库中是 included 作为 Git 子模块。 CMake 应在首次运行时自动查找 Asio 的标头。您可能在克隆项目后忘记运行git submodule initgit submodule update。在克隆 restbed 的目录中运行这些命令,构建应该开始工作。

    如果您确实需要将 restbed 指向特定的 asio 安装,根据 this file,只需将 CMake 变量 asio_INCLUDE 设置为包含 asio.hpp 的目录。

    【讨论】:

    • 谢谢!当你不是来自 C 世界时的有用信息
    【解决方案2】:

    您是否按照自述文件中的说明进行操作?

    git clone --recursive https://github.com/corvusoft/restbed.git
    mkdir restbed/build
    cd restbed/build
    cmake [-DBUILD_TESTS=YES] [-DBUILD_EXAMPLES=YES] [-DBUILD_SSL=NO] [-DBUILD_SHARED=YES] [-DCMAKE_INSTALL_PREFIX=/output-directory] ..
    make [-j CPU_CORES+1] install
    make test
    

    【讨论】:

    • 我在windows下使用cmake 3.8.1,@MultipleMonomials回答解决了ASIO的问题,现在我正在尝试解决这个问题:CMake Error at cmake/modules/Findopenssl.cmake:19 (message): Failed to locate OpenSSL dependency. see restbed/dependency/openssl; ./config shared; make all Call Stack (most recent call first): CMakeLists.txt:38 (find_package)跨度>
    • git clone --recursive 将在一个命令中执行子模块初始化和更新。请确保您已执行此操作。
    【解决方案3】:

    您收到此错误是因为未安装 asio 库。

    https://think-async.com/Asio/下载、构建和安装asio库

    ./configure --without-boost
    make
    sudo make install
    

    然后下载restbed并构建

    git clone https://github.com/Corvusoft/restbed.git
    mkdir restbed/build
    cd restbed/build
    cmake -D BUILD_SSL=OFF -D BUILD_TESTS=OFF -D BUILD_STATIC=ON -D BUILD_SHARED=OFF ..
    make
    make install
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-01-14
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多