本文档翻译自:https://docs.conan.io/en/latest/reference/commands/output/install.html
    :::success Warning**
    这是一项实验性功能,可能会在将来的发行版中进行重大更改。 :::

    conan installconan create提供了--json参数来生成包含安装过程信息的文件。

    输出JSON包含两个第一级密钥:

    • error:如果安装成功完成且没有错误,则为True,否则为False
    • installed:已安装软件包的列表。每个元素包含:
      • recipe:代表下载配方的文档。
        • remote:远程URL(如果已下载配方)。否则为null。
        • cachetrue / false。从缓存中检索(未下载)。
        • downloadedtrue/false。从远程下载(不在缓存中)。
        • timeISO 8601字符串以及下载/检索配方的时间。
        • errortrue / false
        • id:参考。例如“ openssl / 1.0.2u”
        • name:打包库的名称。例如“ openssl”
        • version:打包库的版本。例如“ 1.0.2u”
        • user:打包库的用户。例如“柯南”
        • channel:打包库的通道。例如“稳定”
        • dependencytrue / false。是要安装/创建的软件包还是依赖项。与develop conanfile属性相同。
      • packages:元素列表,代表为配方下载的二进制软件包。通常,此列表中只有1个元素,只有在特殊情况下,如果有构建要求,被此列表覆盖的私有依赖项和设置,可能会有多个元素。
        • remote:远程URL(如果已下载配方)。否则为null
        • cachetrue / false。从缓存中检索(未下载)。
        • downloadedtrue / false。从远程下载(不在缓存中)。
        • time:ISO 8601字符串以及下载/检索配方的时间。
        • errortrue / false
        • id:包ID。例如“ 8018a4df6e7d2b4630a814fa40c81b85b9182d2b”
        • cpp_info:字典,包含在配方的package_info方法中定义的构建信息。

    Example:

    1. $ conan install openssl/1.0.2u@ --json install.json

    install.json

    1. {
    2. "error": false,
    3. "installed": [{
    4. "recipe": {
    5. "id": "openssl/1.0.2u",
    6. "downloaded": true,
    7. "exported": false,
    8. "error": null,
    9. "remote": "https://conan.bintray.com",
    10. "time": "2020-01-30T19:19:21.217923",
    11. "dependency": true,
    12. "name": "openssl",
    13. "version": "1.0.2u",
    14. "user": null,
    15. "channel": null
    16. },
    17. "packages": [{
    18. "id": "f99afdbf2a1cc98ba2029817b35103455b6a9b77",
    19. "downloaded": true,
    20. "exported": false,
    21. "error": null,
    22. "remote": "https://conan.bintray.com",
    23. "time": "2020-01-30T19:19:27.662199",
    24. "built": false,
    25. "cpp_info": {
    26. "name": "openssl",
    27. "names": {
    28. "cmake_find_package": "OpenSSL",
    29. "cmake_find_package_multi": "OpenSSL"
    30. },
    31. "includedirs": ["include"],
    32. "libdirs": ["lib"],
    33. "resdirs": ["res"],
    34. "bindirs": ["bin"],
    35. "builddirs": [""],
    36. "frameworkdirs": ["Frameworks"],
    37. "libs": ["ssl", "crypto", "dl", "pthread"],
    38. "rootpath": "/home/user/.conan/data/openssl/1.0.2u/_/_/package/f99afdbf2a1cc98ba2029817b35103455b6a9b77",
    39. "version": "1.0.2u",
    40. "description": "A toolkit for the Transport Layer Security (TLS) and Secure Sockets Layer (SSL) protocols",
    41. "filter_empty": true,
    42. "public_deps": ["zlib"]
    43. }
    44. }]
    45. }, {
    46. "recipe": {
    47. "id": "zlib/1.2.11#1cd4a227e1b846f961bf91fcb6f3980f",
    48. "downloaded": false,
    49. "exported": false,
    50. "error": null,
    51. "remote": null,
    52. "time": "2020-01-30T19:19:21.237131",
    53. "dependency": true,
    54. "name": "zlib",
    55. "version": "1.2.11",
    56. "user": null,
    57. "channel": null
    58. },
    59. "packages": [{
    60. "id": "6af9cc7cb931c5ad942174fd7838eb655717c709",
    61. "downloaded": false,
    62. "exported": false,
    63. "error": null,
    64. "remote": null,
    65. "time": "2020-01-30T19:19:22.061885",
    66. "built": false,
    67. "cpp_info": {
    68. "name": "ZLIB",
    69. "includedirs": ["include"],
    70. "libdirs": ["lib"],
    71. "resdirs": ["res"],
    72. "bindirs": ["bin"],
    73. "builddirs": [""],
    74. "frameworkdirs": ["Frameworks"],
    75. "libs": ["z"],
    76. "rootpath": "/home/user/.conan/data/zlib/1.2.11/_/_/package/6af9cc7cb931c5ad942174fd7838eb655717c709",
    77. "version": "1.2.11",
    78. "description": "A Massively Spiffy Yet Delicately Unobtrusive Compression Library (Also Free, Not to Mention Unencumbered by Patents)",
    79. "filter_empty": true
    80. }
    81. }]
    82. }]
    83. }

    :::info Note
    由于这被标记为实验性的,因此可能会删除或添加一些字段:cpp_info中的字段版本和说明最终将被删除,并且绝对值的路径可能会更改。 :::