swagger-api/swagger-codegen

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

Open

#5,880 创建于 2017年6月19日

在 GitHub 查看
 (6 评论) (1 反应) (0 负责人)HTML (5,474 fork)batch import
Client: C++General: Suggestionhelp wanted

仓库指标

Star
 (12,701 star)
PR 合并指标
 (30 天内没有已合并 PR)

描述

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

贡献者指南