Search code examples
visual-studio-2015cmakeboost-asiorestbed

CMake Error at cmake/modules/Findasio.cmake:11 - Failed to locate ASIO dependency


I'm trying to use the restbed framework in a visual studio 2015 project.

I cloned the restbed repo: https://github.com/Corvusoft/restbed.git

And to create a Visual studio project file I'm using current cmake 3.8.1 version

Now, when trying to configure restbed with cmake, I got this error:

  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)

Is there a way how to solve this Asio problem ?

Right now I'm trying to compile Boost library to see where to find and add these Asio dependencies to Cmake.

Content of CMakeLists.txt file for restbed:

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 (configure) output:

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".

Solution

  • Asio (not to be confused with boost asio) is included in the restbed repository as a Git submodule. CMake should automatically find Asio's headers when it is first run. You probably forgot to run git submodule init and git submodule update after cloning the project. Run those commands in the directory where you cloned restbed, and the build should start working.

    If you did need to point restbed to a specific asio installation, per this file, just set the CMake variable asio_INCLUDE to the directory containing asio.hpp.