{"id":293,"date":"2023-08-26T15:49:51","date_gmt":"2023-08-26T07:49:51","guid":{"rendered":"https:\/\/boostup.cf\/?p=293"},"modified":"2025-11-09T17:39:18","modified_gmt":"2025-11-09T09:39:18","slug":"cmake","status":"publish","type":"post","link":"https:\/\/189505.xyz\/?p=293","title":{"rendered":"cmake"},"content":{"rendered":"<div id=\"ez-toc-container\" class=\"ez-toc-v2_0_40 counter-hierarchy ez-toc-counter ez-toc-grey ez-toc-container-direction\">\n<div class=\"ez-toc-title-container\">\n<p class=\"ez-toc-title\">Table of Contents<\/p>\n<span class=\"ez-toc-title-toggle\"><a href=\"#\" class=\"ez-toc-pull-right ez-toc-btn ez-toc-btn-xs ez-toc-btn-default ez-toc-toggle\" area-label=\"ez-toc-toggle-icon-1\"><label for=\"item-69e0761e8d9f6\" aria-label=\"Table of Content\"><span style=\"display: flex;align-items: center;width: 35px;height: 30px;justify-content: center;direction:ltr;\"><svg style=\"fill: #999;color:#999\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" class=\"list-377408\" width=\"20px\" height=\"20px\" viewBox=\"0 0 24 24\" fill=\"none\"><path d=\"M6 6H4v2h2V6zm14 0H8v2h12V6zM4 11h2v2H4v-2zm16 0H8v2h12v-2zM4 16h2v2H4v-2zm16 0H8v2h12v-2z\" fill=\"currentColor\"><\/path><\/svg><svg style=\"fill: #999;color:#999\" class=\"arrow-unsorted-368013\" xmlns=\"http:\/\/www.w3.org\/2000\/svg\" width=\"10px\" height=\"10px\" viewBox=\"0 0 24 24\" version=\"1.2\" baseProfile=\"tiny\"><path d=\"M18.2 9.3l-6.2-6.3-6.2 6.3c-.2.2-.3.4-.3.7s.1.5.3.7c.2.2.4.3.7.3h11c.3 0 .5-.1.7-.3.2-.2.3-.5.3-.7s-.1-.5-.3-.7zM5.8 14.7l6.2 6.3 6.2-6.3c.2-.2.3-.5.3-.7s-.1-.5-.3-.7c-.2-.2-.4-.3-.7-.3h-11c-.3 0-.5.1-.7.3-.2.2-.3.5-.3.7s.1.5.3.7z\"\/><\/svg><\/span><\/label><input  type=\"checkbox\" id=\"item-69e0761e8d9f6\"><\/a><\/span><\/div>\n<nav><ul class='ez-toc-list ez-toc-list-level-1 ' ><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-1\" href=\"https:\/\/189505.xyz\/?p=293\/#PROJECT-NAME_SOURCE_DIR\" title=\"\nPROJECT-NAME_SOURCE_DIR \n\">\nPROJECT-NAME_SOURCE_DIR \n<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-2\" href=\"https:\/\/189505.xyz\/?p=293\/#generate_makefile_or_ninja_file\" title=\"generate makefile or ninja file\">generate makefile or ninja file<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-3\" href=\"https:\/\/189505.xyz\/?p=293\/#build\" title=\"build\">build<\/a><\/li><li class='ez-toc-page-1 ez-toc-heading-level-1'><a class=\"ez-toc-link ez-toc-heading-4\" href=\"https:\/\/189505.xyz\/?p=293\/#install\" title=\"install\">install<\/a><\/li><\/ul><\/nav><\/div>\n<h1><span class=\"ez-toc-section\" id=\"PROJECT-NAME_SOURCE_DIR\"><\/span>\nPROJECT-NAME_SOURCE_DIR<br \/>\n<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<h1><span class=\"ez-toc-section\" id=\"generate_makefile_or_ninja_file\"><\/span>generate makefile or ninja file<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code>#makefile\ncmake -B build -S . -DCMAKE_INSTALL_PREFIX=install\nor\n# ninja\ncmake -G Ninja -B build -S . -DCMAKE_INSTALL_PREFIX=install<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"build\"><\/span>build<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code>cmake --build build\/ --target all<\/code><\/pre>\n<h1><span class=\"ez-toc-section\" id=\"install\"><\/span>install<span class=\"ez-toc-section-end\"><\/span><\/h1>\n<pre><code># custom prefix when install:\ncmake --install build --prefix install-v2\n# using  -DCMAKE_INSTALL_PREFIX dir\ncmake --install build<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>PROJECT-NAME_SOURCE_DIR generate makefile or ninja file &#8230; <a title=\"cmake\" class=\"read-more\" href=\"https:\/\/189505.xyz\/?p=293\" aria-label=\"More on cmake\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/293"}],"collection":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=293"}],"version-history":[{"count":2,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/293\/revisions"}],"predecessor-version":[{"id":651,"href":"https:\/\/189505.xyz\/index.php?rest_route=\/wp\/v2\/posts\/293\/revisions\/651"}],"wp:attachment":[{"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=293"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=293"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/189505.xyz\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=293"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}