Skip to content

[CPPREST][C++] Suggest Using Conan.io for C++ Dependencies #5880

Open
@solvingj

Description

@solvingj
Description

The current CPPREST generator requires manual dependency management. Developers have to download CPPRest and Boost libraries, extract them, and then manually update the CMakeLists.txt file to point to their location on disk. For a novice with CMake this can be non-trivial.

Conan.io has recently emerged as a viable cross-platform package management system for C++, providing an experience much like maven and nuget, and features CMake support.

For a minimal implementation, the swagger generator would need to create a conanfile.txt and make some slight changes to the current CMakeLists.txt template.

Example: conanfile.txt

[requires]
CppRestSdk/2.8.0@ViaviSolutions/stable

[generators]
cmake

The CMakeLists.txt file would need to add something like the following two lines:

include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup()

The last change users would have to make is to run the following command in the directory that contains the conanfile.txt:

conan install --build OpenSSL

This is analogous to maven install, which downloads all the required packages and their transitive dependencies to cache, and generates "conanbuildinfo.cmake".

Several lines could then be removed from the existing CMakeLists.txt template. A more experienced CMake person whould be able to define a new template better than I.

Here is a link to the conan.io reference for cmake:
http://conanio.readthedocs.io/en/latest/integrations/cmake/cmake_generator.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions