{"id":1639,"date":"2024-11-07T17:29:49","date_gmt":"2024-11-07T09:29:49","guid":{"rendered":"https:\/\/www.mustenaka.cn\/?p=1639"},"modified":"2024-11-07T18:32:55","modified_gmt":"2024-11-07T10:32:55","slug":"clionusesvcpkgforcppenvironmentmanagementmacoswindows","status":"publish","type":"post","link":"https:\/\/www.mustenaka.cn\/index.php\/2024\/11\/07\/clionusesvcpkgforcppenvironmentmanagementmacoswindows\/","title":{"rendered":"clion \u4f7f\u7528 vcpkg \u8fdb\u884cc++\u73af\u5883\u7ba1\u7406(macOS\u3001Windows)"},"content":{"rendered":"<h1>clion \u4f7f\u7528 vcpkg \u8fdb\u884cc++\u73af\u5883\u7ba1\u7406(macOS\u3001Windows)<\/h1>\n<p>\u5982\u4f55\u4f7f\u7528Clion\u4f7f\u7528vcpkg\u8fdb\u884c\u6709\u6548\u7684c++\u7ba1\u7406\uff08\u5df2\u6d4b\u8bd5macOS\u5e73\u53f0\u53caWindows\u5e73\u53f0\uff09\uff0c\u53c2\u8003Clion\u7684\u5b98\u65b9\u8d44\u6599\u8fdb\u884c\u6574\u5408\uff0c\u4f1a\u53d1\u73b0\u6ca1\u6cd5\u76f4\u63a5\u4f7f\u7528\u7684\u95ee\u9898\uff0c\u56e0\u6b64\u53c2\u8003\u4f7f\u7528\u53ccvcpkg\u73af\u5883\u7684\u65b9\u5f0f\uff08\u4e5f\u53ef\u4ee5\u5355\u73af\u5883\uff0c\u5254\u9664clion\u9ed8\u8ba4\u4e0b\u8f7d\u7684\u54ea\u4e2a\u5c31\u53ef\u4ee5\uff0c\u6216\u8005\u7528\u54ea\u4e2a\u914d\u7f6e\u73af\u5883\u53d8\u91cf\u4e5f\u53ef\u4ee5\uff09\uff1a<a href=\"https:\/\/www.jetbrains.com\/help\/clion\/package-management.html\">https:\/\/www.jetbrains.com\/help\/clion\/package-management.html<\/a><\/p>\n<p>\u63d0\u524d\u51c6\u5907\u73af\u5883<\/p>\n<ol>\n<li>\u6709\u6548\u7684\u7f16\u8bd1\u5668(gcc\\clang\\msvc)<\/li>\n<li>\u5b89\u88c5visual studio\uff08windows\u53ef\u9009\uff09<\/li>\n<li>ninja (macOS\u53caLinux\u5e73\u53f0\u5fc5\u9009)<\/li>\n<\/ol>\n<h3>\u53c2\u8003\u6d41\u7a0b\u6b63\u5e38\u5b89\u88c5vcpkg<\/h3>\n<p>\u6253\u5f00vcpkg\u7ba1\u7406\u5668<\/p>\n<blockquote><p>View &#8211; Tool Windows &#8211; vcpkg<\/p><\/blockquote>\n<p><img fetchpriority=\"high\" decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/0a676d5b044766179906d46455345f74-300x180.png\" alt=\"\" width=\"908\" height=\"545\" class=\"wp-image-1642 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/0a676d5b044766179906d46455345f74-300x180.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/0a676d5b044766179906d46455345f74-1024x613.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/0a676d5b044766179906d46455345f74-768x460.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/0a676d5b044766179906d46455345f74-1536x920.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/0a676d5b044766179906d46455345f74-2048x1227.png 2048w\" sizes=\"(max-width: 908px) 100vw, 908px\" \/><\/p>\n<p>\u8fd9\u4e2a\u6b65\u9aa4\u6700\u597d\u542f\u52a8\u4e00\u4e0b\u9b54\u6cd5<\/p>\n<p>\u6309\u7167\u987a\u5e8f\u70b9+\u65b0\u5efavcpkg\u73af\u5883 &#8211; \u76f4\u63a5OK\uff0c\u4f1a\u9ed8\u8ba4\u4ece\u5b98\u65b9github\u5730\u5740\u4e0b\u8f7dvcpkg<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/ab3a388f62935a470333f5959d3c9bdd-300x179.png\" alt=\"\" width=\"758\" height=\"452\" class=\" wp-image-1643 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/ab3a388f62935a470333f5959d3c9bdd-300x179.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/ab3a388f62935a470333f5959d3c9bdd-1024x611.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/ab3a388f62935a470333f5959d3c9bdd-768x458.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/ab3a388f62935a470333f5959d3c9bdd-1536x917.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/ab3a388f62935a470333f5959d3c9bdd-2048x1222.png 2048w\" sizes=\"(max-width: 758px) 100vw, 758px\" \/><\/p>\n<p>\u5207\u6362\u5230 Manifest Mode\uff0c\u521b\u5efavcpkg.json \uff0c\u8fd9\u4e2a\u6a21\u5f0f\u4e0b\u76f8\u5f53\u4e8e\u521b\u5efa\u4e00\u4e2a\u914d\u7f6e\u5355\uff0c\u4e4b\u540e\u4f7f\u7528\u547d\u4ee4\u5c31\u53ef\u4ee5\u8bc6\u522b\u8fd9\u4e2a\u914d\u7f6e\u5355\u8fdb\u884c\u5b89\u88c5\u3002<\/p>\n<p>\u8bd5\u4e00\u4e0b\uff0c\u70b9\u51fb\u641c\u7d22\uff0c\u8f93\u5165\u81ea\u5df1\u60f3\u8981\u627e\u7684\u5305\u540d\uff0c\u5c31\u53ef\u4ee5\u6b63\u5e38\u4f7f\u7528\u4e86\u3002\u4f46\u5b9e\u9645\u4e0a\u8fd9\u6837\u64cd\u4f5c\u5e76\u6ca1\u6709\u751f\u6548\u5185\u5bb9\uff0c\u6587\u4ef6\u6ca1\u6709\u4e0b\u8f7d\uff0c\u4e5f\u6ca1\u6709\u5bfc\u5165\u6210\u529f\u3002<\/p>\n<h3>\u72ec\u7acb\u5b89\u88c5<\/h3>\n<p>\u53c2\u8003\u5b98\u65b9\u9879\u76ee\u94fe\u63a5<a href=\"https:\/\/github.com\/microsoft\/vcpkg\">https:\/\/github.com\/microsoft\/vcpkg<\/a><\/p>\n<h3>Windows\u6269\u5c55\u6b63\u5f0f\u4f7f\u7528<\/h3>\n<p>\u6253\u5f00clion\u7684\u63a7\u5236\u53f0\uff0c\u8f93\u5165vcpkg\uff0c\u53d1\u73b0\u6ca1\u6709\u547d\u4ee4\uff0c\u5728\u5b89\u88c5\u4e86Visual Studio\u4e4b\u540e\uff0c\u8f93\u5165&#8221;Developer PowerShell for VS 2022&#8243; \u6253\u5f00vs\u7684\u63a7\u5236\u53f0<\/p>\n<blockquote><p>\u5c0f\u8d34\u58eb\uff1a<\/p>\n<p>\u5982\u679c\u51fa\u73b0<\/p>\n<p>\u65e0\u6cd5\u52a0\u8f7d\u6587\u4ef6 C:\\Users\\****\\profile.ps1\uff0c\u56e0\u4e3a\u5728\u6b64\u7cfb\u7edf\u4e0a\u7981\u6b62\u8fd0\u884c\u811a\u672c\u3002\u6709\u5173\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u53c2<br \/>\n\u9605 https:\/go.microsoft.com\/fwlink\/?LinkID=135170 \u4e2d\u7684 about_Execution_Policies\u3002<br \/>\n\u6240\u5728\u4f4d\u7f6e \u884c:1 \u5b57\u7b26: 3<br \/>\n+ . &#8216;C:\\Users\\***\\Documents\\WindowsPowerShell\\profile.ps1&#8217;<br \/>\n+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~<br \/>\n+ CategoryInfo : SecurityError: (:) []\uff0cPSSecurityException<br \/>\n+ FullyQualifiedErrorId : UnauthorizedAccess<\/p>\n<p>\u53ef\u4ee5\u8f93\u5165<strong>Set-ExecutionPolicy RemoteSigned -Scope CurrentUser <\/strong>\u4fee\u6539\u7b56\u7565\u5373\u53ef\u6b63\u5e38\u52a0\u8f7d<\/p><\/blockquote>\n<p>\u8f93\u5165Get-Command vcpkg | Out-String -Width 200\u627e\u5230\u9ed8\u8ba4\u7684vcpkg\u5b89\u88c5\u4f4d\u7f6e\uff0c\u5e76\u5bf9\u8be5\u4f4d\u7f6e\u521b\u5efa\u73af\u5883\u53d8\u91cf<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/cb950bd5f16f36c39308d642c39d30ef-300x42.png\" alt=\"\" width=\"679\" height=\"95\" class=\" wp-image-1645 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/cb950bd5f16f36c39308d642c39d30ef-300x42.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/cb950bd5f16f36c39308d642c39d30ef-1024x142.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/cb950bd5f16f36c39308d642c39d30ef-768x107.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/cb950bd5f16f36c39308d642c39d30ef-1536x214.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/cb950bd5f16f36c39308d642c39d30ef.png 1725w\" sizes=\"(max-width: 679px) 100vw, 679px\" \/><\/p>\n<p>\u4e4b\u540e\u4efb\u610f\u6253\u5f00\u63a7\u5236\u53f0\u5373\u53ef\u4f7f\u7528vcpkg\uff0c\u5e76\u56de\u5230clion\uff0c\u6d4b\u8bd5\u4e00\u4e2a\u5305\uff0c\u6211\u8fd9\u91cc\u4f7f\u7528nlohmann-json\u5305\u6d4b\u8bd5\uff0c\u8f93\u5165nlohmann\u8fdb\u884c\u641c\u7d22\uff08\u522b\u641c\u7d22json\uff0c\u592a\u591a\u540d\u5b57\u6709json\u7684\u5305\u4e86\uff09\uff0c\u70b9\u51fbadd<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/d7b99ea6f0e5922cad7818ec7b781bde-300x179.png\" alt=\"\" width=\"761\" height=\"454\" class=\" wp-image-1647 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/d7b99ea6f0e5922cad7818ec7b781bde-300x179.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/d7b99ea6f0e5922cad7818ec7b781bde-1024x611.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/d7b99ea6f0e5922cad7818ec7b781bde-768x458.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/d7b99ea6f0e5922cad7818ec7b781bde-1536x917.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/d7b99ea6f0e5922cad7818ec7b781bde-2048x1222.png 2048w\" sizes=\"(max-width: 761px) 100vw, 761px\" \/><\/p>\n<p>\u6dfb\u52a0\u5b8c\u6210\u540e\uff0cvcpkg.json\u81ea\u52a8\u66f4\u65b0\uff0c\u6253\u5f00clion\u7684\u63a7\u5236\u53f0\u8f93\u5165vcpkg install \u8fdb\u884c\u5b89\u88c5\uff0c\u7b49\u5f85\u4e00\u6bb5\u65f6\u95f4\u540e\u5373\u5b89\u88c5\u6210\u529f\u3002<\/p>\n<h6>\u63d0\u793a\u9700\u8981\u624b\u52a8\u628a\u5305\u4e22\u5165cmake<\/h6>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">Stored binaries in 1 destinations in 87.5 ms.\r\nElapsed time to handle nlohmann-json:x64-windows: 3.5 s\r\nnlohmann-json:x64-windows package ABI: 73840e243b7ee9b3e8da9186302a33d97954e73241bfb4e4e2cda5e9adf011cb\r\nTotal install time: 3.5 s\r\nThe package nlohmann-json provides CMake targets:\r\n\r\n    find_package(nlohmann_json CONFIG REQUIRED)\r\n    target_link_libraries(main PRIVATE nlohmann_json::nlohmann_json)\r\n\r\nThe package nlohmann-json can be configured to not provide implicit conversions via a custom triplet file:\r\n\r\n    set(nlohmann-json_IMPLICIT_CONVERSIONS OFF)\r\n\r\nFor more information, see the docs here:\r\n\r\n    https:\/\/json.nlohmann.me\/api\/macros\/json_use_implicit_conversions\/\r\n<\/code><\/pre>\n<p>\u4fee\u6539cmake\uff0c\u6ce8\u610f\u7c98\u8d34target_link_libraries\u7684\u65f6\u5019\uff0c\u9700\u8981\u548c\u9879\u76ee\u540d\u79f0\u4e00\u81f4<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/53c15c1910f417201cb6d331d4e4aae2-300x181.png\" alt=\"\" width=\"897\" height=\"541\" class=\" wp-image-1648 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/53c15c1910f417201cb6d331d4e4aae2-300x181.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/53c15c1910f417201cb6d331d4e4aae2-1024x618.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/53c15c1910f417201cb6d331d4e4aae2-768x463.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/53c15c1910f417201cb6d331d4e4aae2-1536x927.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/53c15c1910f417201cb6d331d4e4aae2-2048x1235.png 2048w\" sizes=\"(max-width: 897px) 100vw, 897px\" \/><\/p>\n<p>\u7136\u540e\u559c\u63d0Cmake\u627e\u4e0d\u5230\u8fd9\u4e2a\u5305\uff08\u5373\u4f7f\u5df2\u7ecf\u4e0b\u8f7d\u4e0b\u6765\u4e86\uff09<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/7c309dfe7345c64916c9b64013001258-300x88.png\" alt=\"\" width=\"876\" height=\"257\" class=\" wp-image-1649 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/7c309dfe7345c64916c9b64013001258-300x88.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/7c309dfe7345c64916c9b64013001258-1024x301.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/7c309dfe7345c64916c9b64013001258-768x226.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/7c309dfe7345c64916c9b64013001258-1536x452.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/7c309dfe7345c64916c9b64013001258-2048x603.png 2048w\" sizes=\"(max-width: 876px) 100vw, 876px\" \/><\/p>\n<p>\u9700\u8981\u521b\u5efa\u4e00\u4e2a\u65b0\u7684Cmake\u73af\u5883<\/p>\n<h3><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/f01acb006b5b3d4726bbc2ac2a2d98df-300x181.png\" alt=\"\" width=\"810\" height=\"489\" class=\" wp-image-1650 aligncenter\" srcset=\"https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/f01acb006b5b3d4726bbc2ac2a2d98df-300x181.png 300w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/f01acb006b5b3d4726bbc2ac2a2d98df-1024x618.png 1024w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/f01acb006b5b3d4726bbc2ac2a2d98df-768x463.png 768w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/f01acb006b5b3d4726bbc2ac2a2d98df-1536x927.png 1536w, https:\/\/www.mustenaka.cn\/wp-content\/uploads\/2024\/11\/f01acb006b5b3d4726bbc2ac2a2d98df-2048x1235.png 2048w\" sizes=\"(max-width: 810px) 100vw, 810px\" \/><\/h3>\n<p>\u6b64\u65f6\u8fdb\u884c\u7f16\u8bd1\uff0cCMake\u8bc6\u522b\uff0c\u6ce8\u610fCMake\u8bc6\u522b\u4e86\u4e4b\u540e\uff0ccpp\u4ee3\u7801\u90e8\u5206\u8fd8\u6ca1\u6709\u8bc6\u522b\uff0c\u6b64\u65f6\u9519\u8bef\u7684\u90e8\u5206\u4f1a\u6709\u4e00\u4e2acmake reload\u56fe\u6807\uff0c\u70b9\u51fb\u540e\u5237\u65b0\uff08\u90e8\u5206\u65f6\u5019\u9700\u8981\u91cd\u542fIDE\uff09\uff0c\u5373\u53ef\u5237\u65b0\u3002\u6b64\u65f6\u7f16\u8bd1\u53ef\u4ee5\u6b63\u5e38\u751f\u6210<\/p>\n<p>\u4e00\u4efd\u6d4b\u8bd5\u4ee3\u7801\uff1a<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" cpp=\"\">#include &lt;iostream&gt;\r\n#include &lt;nlohmann\/json.hpp&gt;\r\n\r\n\/\/ \u4f7f\u7528 nlohmann::json \u522b\u540d\u4e3a json\uff0c\u65b9\u4fbf\u540e\u7eed\u4f7f\u7528\r\nusing json = nlohmann::json;\r\n\r\nint main() {\r\n    \/\/ \u521b\u5efa\u4e00\u4e2a JSON \u5bf9\u8c61\r\n    json j;\r\n\r\n    \/\/ \u624b\u52a8\u8d4b\u503c\u6570\u636e\r\n    j[\"id\"] = \"123\";\r\n    j[\"name\"] = \"John Doe\";\r\n    j[\"age\"] = 30;\r\n    j[\"is_student\"] = false;\r\n    j[\"hobbies\"] = {\"reading\", \"coding\", \"hiking\"};\r\n\r\n    \/\/ \u5d4c\u5957\u5bf9\u8c61\r\n    j[\"address\"] = {\r\n        {\"city\", \"New York\"},\r\n        {\"zipcode\", \"10001\"},\r\n        {\"country\", \"USA\"}\r\n    };\r\n\r\n    \/\/ \u5c06 JSON \u5bf9\u8c61\u8f93\u51fa\u4e3a\u5b57\u7b26\u4e32\r\n    std::cout &lt;&lt; \"JSON output:\\n\" &lt;&lt; j.dump(4) &lt;&lt; std::endl;\r\n\r\n    \/\/ \u8bfb\u53d6 JSON \u6570\u636e\r\n    std::string name = j[\"name\"];\r\n    int age = j[\"age\"];\r\n    bool is_student = j[\"is_student\"];\r\n    std::string city = j[\"address\"][\"city\"];\r\n\r\n    \/\/ \u8f93\u51fa\u8bfb\u53d6\u7684\u6570\u636e\r\n    std::cout &lt;&lt; \"\\nParsed data:\\n\";\r\n    std::cout &lt;&lt; \"Name: \" &lt;&lt; name &lt;&lt; \"\\n\";\r\n    std::cout &lt;&lt; \"Age: \" &lt;&lt; age &lt;&lt; \"\\n\";\r\n    std::cout &lt;&lt; \"Is Student: \" &lt;&lt; std::boolalpha &lt;&lt; is_student &lt;&lt; \"\\n\";\r\n    std::cout &lt;&lt; \"City: \" &lt;&lt; city &lt;&lt; \"\\n\";\r\n\r\n    \/\/ \u4fee\u6539 JSON \u6570\u636e\r\n    j[\"age\"] = 31;  \/\/ \u66f4\u65b0\u5e74\u9f84\r\n    j[\"hobbies\"].push_back(\"gaming\");  \/\/ \u6dfb\u52a0\u65b0\u7231\u597d\r\n\r\n    \/\/ \u8f93\u51fa\u4fee\u6539\u540e\u7684 JSON\r\n    std::cout &lt;&lt; \"\\nUpdated JSON:\\n\" &lt;&lt; j.dump(4) &lt;&lt; std::endl;\r\n\r\n    return 0;\r\n}\r\n<\/code><\/pre>\n<p>&nbsp;<\/p>\n<h3>macOS \u6269\u5c55\u6b63\u5f0f\u4f7f\u7528<\/h3>\n<p>&nbsp;<\/p>\n<h3>\u719f\u6089vcpkg\u547d\u4ee4\u548c\u6a21\u5f0f<\/h3>\n<p>manifest \u6a21\u5f0f<\/p>\n<p><strong>Manifest \u6a21\u5f0f<\/strong>\u662fvcpkg\u5f15\u5165\u7684\u4e00\u79cd\u65b0\u7684\u5305\u7ba1\u7406\u65b9\u5f0f\uff0c\u5229\u7528<code>vcpkg.json<\/code>\u6587\u4ef6\u6765\u7ba1\u7406\u9879\u76ee\u4f9d\u8d56\u3002\u901a\u8fc7\u8fd9\u79cd\u65b9\u5f0f\uff0c\u9879\u76ee\u7684\u4f9d\u8d56\u9879\u548c\u7248\u672c\u4fe1\u606f\u88ab\u660e\u786e\u5730\u5b9a\u4e49\u5728\u4e00\u4e2a\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u5141\u8bb8vcpkg\u4e3a\u9879\u76ee\u81ea\u52a8\u5b89\u88c5\u6240\u6709\u5fc5\u8981\u7684\u4f9d\u8d56\u9879\u3002Manifest \u6a21\u5f0f\u66f4\u9002\u5408\u4e8e\u9700\u8981\u7ba1\u7406\u591a\u4e2a\u5305\u7248\u672c\u6216\u8005\u4e0d\u540c\u73af\u5883\u914d\u7f6e\u7684\u573a\u666f\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">vcpkg new --application\r\nvcpkg add port fmt<\/code><\/pre>\n<p>\u76f4\u63a5install\u6a21\u5f0f<\/p>\n<p><strong>\u76f4\u63a5\u5b89\u88c5\u6a21\u5f0f<\/strong>\u662fvcpkg\u7684\u4f20\u7edf\u5b89\u88c5\u65b9\u5f0f\uff0c\u5728\u8fd9\u79cd\u6a21\u5f0f\u4e0b\uff0c\u4f60\u76f4\u63a5\u901a\u8fc7\u547d\u4ee4\u5b89\u88c5\u4e00\u4e2a\u6216\u591a\u4e2a\u5305\u3002\u8fd9\u79cd\u65b9\u5f0f\u9002\u7528\u4e8e\u5355\u4e2a\u5305\u7684\u5feb\u901f\u5b89\u88c5\uff0c\u6216\u8005\u4f60\u4e0d\u9700\u8981\u7248\u672c\u63a7\u5236\u7684\u7b80\u5355\u9879\u76ee\u3002<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">vcpkg install fmt<\/code><\/pre>\n<h3>BUG\u53ca\u89e3\u51b3<\/h3>\n<h6>\u548canaconda\u73af\u5883\u5305\u540c\u540d\u4e4b\u540e\u53d1\u751f\u73af\u5883\u51b2\u7a81<\/h6>\n<p>\u4ee5fmt\u4e3a\u4f8b\uff0ccmake\u4f7f\u7528vcpkg\u7684\u5305\u56de\u5408anaconda\u7684\u4e00\u4e2a\u540c\u540d\u7684fmt\u5305\u51b2\u7a81\uff0c\u6b64\u65f6\u9700\u8981\u5c4f\u853danaconda\u73af\u5883\u8bc6\u522b\u624d\u80fd\u6b63\u5e38\u8fdb\u884ccmake\u7f16\u8bd1<\/p>\n<h6>\u53ef\u4ee5\u5728CMake\u547d\u4ee4\u4e2d\u624b\u52a8\u6307\u5b9avcpkg\u8def\u5f84<\/h6>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">set(CMAKE_TOOLCHAIN_FILE \"\/path\/to\/vcpkg\/scripts\/buildsystems\/vcpkg.cmake\" CACHE STRING \"Vcpkg toolchain file\")<\/code><\/pre>\n<h6>\u4e5f\u53ef\u4ee5\u5728Clion\u4e2d\u81ea\u5b9a\u4e49\u73af\u5883\u53d8\u91cf<\/h6>\n<p><strong>Settings<\/strong> &gt; <strong>Build, Execution, Deployment<\/strong> &gt; <strong>CMake<\/strong><\/p>\n<p>\u9009\u62e9\u9879\u76ee\u7684\u914d\u7f6e\uff08\u5982 <code>Debug<\/code> \u6216 <code>Release<\/code>\uff09\uff0c\u5728 <strong>Environment<\/strong> \u4e2d\u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\uff0c\u4f8b\u5982<\/p>\n<pre class=\"pure-highlightjs\"><code class=\"\" null=\"\">PATH=\/path\/to\/vcpkg:\/usr\/local\/bin:\/usr\/bin # \u5c06vcpkg\u8def\u5f84\u653e\u5728\u524d\u9762<\/code><\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>clion \u4f7f\u7528 vcpkg \u8fdb\u884cc++\u73af\u5883\u7ba1\u7406(macOS\u3001Windows) \u5982\u4f55\u4f7f\u7528Clion\u4f7f [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[32,86,71,133],"tags":[],"class_list":["post-1639","post","type-post","status-publish","format-standard","hentry","category-cpp","category-macos","category-windows","category-133"],"views":2953,"_links":{"self":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/1639","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1639"}],"version-history":[{"count":6,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/1639\/revisions"}],"predecessor-version":[{"id":1653,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/posts\/1639\/revisions\/1653"}],"wp:attachment":[{"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1639"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1639"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.mustenaka.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1639"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}