swagger-api / swagger-api/swagger-codegen

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

Open
#5,880 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Client: C++ General: Suggestion help wanted
Dominant language
Mustache
Stars
17.8k
Forks
6k
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the CPPREST generator's existing CMakeLists.txt template and compare its manual dependency handling with the proposed conanfile.txt and CMake additions. Validate the generated project with Conan and CMake; done means dependencies can be installed through Conan without the existing manual path edits.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, cpp
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.