swagger-api/swagger-codegen

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

开放

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

 (6 条评论) (1 个反应) (0 位负责人)HTML (5,474 个派生)batch import
Client: C++General: Suggestionhelp wanted

仓库指标

星标
 (12,701 个星标)
PR 合并指标
 (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

贡献者指南