{"id":1422,"date":"2012-03-27T23:16:57","date_gmt":"2012-03-27T14:16:57","guid":{"rendered":"http:\/\/mattyan.net\/blog\/?p=1422"},"modified":"2012-03-27T23:16:57","modified_gmt":"2012-03-27T14:16:57","slug":"cmake%e5%b0%8e%e5%85%a5%e4%b8%ad","status":"publish","type":"post","link":"https:\/\/mattyan.net\/blog\/?p=1422","title":{"rendered":"CMake\u5c0e\u5165\u4e2d"},"content":{"rendered":"<p>Autotools\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f\u306e\u304c\u5927\u5909\u306a\u306e\u3067\u3001CMake\u3092\u5c0e\u5165\u3057\u3066\u307f\u305f\u3002<br \/>\n\u3068\u308a\u3042\u3048\u305a\u3001boost::asio\u306e\u7df4\u7fd2\u3064\u3044\u3067\u306bhttp\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068TCP\u30b5\u30fc\u30d0\u30fc\u3092CMake\u3067\u30d3\u30eb\u30c9\u3002<br \/>\n\u5358\u7d14\u306b\u30d3\u30eb\u30c9\u3059\u308b\u3060\u3051\u306a\u3089\u3001<br \/>\n\/CMakeLists.txt<\/p>\n<pre>\n<code class=\"\" data-line=\"\">\nCMAKE_MINIMUM_REQUIRED(VERSION 2.6)\nPROJECT(AsioTest)\n#Boost\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u8a2d\u5b9a\nIF(WIN32 AND NOT UNIX)\n\tSET(BOOST_INCLUDEDIR C:\/MinGW32\/msys\/1.0\/local\/include)\n\tSET(BOOST_LIBRARYDIR C:\/MinGW32\/msys\/1.0\/local\/lib)\nELSE(WIN32 AND NOT UNIX)\nENDIF(WIN32 AND NOT UNIX)\n#boost::system\u306e\u635c\u7d22\nFIND_PACKAGE(Boost COMPONENTS system REQUIRED)\nINCLUDE_DIRECTORIES(${Boost_INCLUDE_DIRS})\n#\u30b5\u30d6\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u306e\u8a2d\u5b9a\nADD_SUBDIRECTORY(httpClient)\nADD_SUBDIRECTORY(server)\n<\/code>\n<\/pre>\n<p>\/httpClient\/CMakeLists.txt<\/p>\n<pre>\n<code class=\"\" data-line=\"\">\nADD_EXECUTABLE(http src\/main.cpp)\nTARGET_LINK_LIBRARIES(http ${Boost_LIBRARIES})\nIF(WIN32 AND NOT UNIX)\n#Windows\u306e\u5834\u5408\u306f\u3001winsock2\u3068mswsock\u304c\u5fc5\u8981\nfind_library(WS2_32_LIBRARY ws2_32)\nTARGET_LINK_LIBRARIES(http ${WS2_32_LIBRARY})\nfind_library(MSWSOCK_LIBRARY mswsock)\nTARGET_LINK_LIBRARIES(http ${MSWSOCK_LIBRARY})\nELSE(WIN32 AND NOT UNIX)\n#Linux\u7cfb\u306fpthread\u304c\u5fc5\u8981\n\tfind_library(PTHREAD_LIBRARY pthread)\n\tTARGET_LINK_LIBRARIES(http ${PTHREAD_LIBRARY})\nendif(WIN32 AND NOT UNIX)\n<\/code>\n<\/pre>\n<p>\/server\/CMakeLists.txt<\/p>\n<pre>\n<code class=\"\" data-line=\"\">\nADD_EXECUTABLE(server src\/main.cpp src\/server.cpp src\/user.cpp)\nTARGET_LINK_LIBRARIES(server ${Boost_LIBRARIES})\nIF(WIN32 AND NOT UNIX)\n#Windows\u306e\u5834\u5408\u306f\u3001winsock2\u3068mswsock\u304c\u5fc5\u8981\n\tFIND_LIBRARY(WS2_32_LIBRARY ws2_32)\n\tTARGET_LINK_LIBRARIES(server ${WS2_32_LIBRARY})\n\tFIND_LIBRARY(MSWSOCK_LIBRARY mswsock)\n\tTARGET_LINK_LIBRARIES(server ${MSWSOCK_LIBRARY})\nELSE(WIN32 AND NOT UNIX)\n#Linux\u7cfb\u306fpthread\u304c\u5fc5\u8981\n\tFIND_LIBRARY(PTHREAD_LIBRARY pthread)\n\tTARGET_LINK_LIBRARIES(server ${PTHREAD_LIBRARY})\nENDIF(WIN32 AND NOT UNIX)\n<\/code>\n<\/pre>\n<p>\u3053\u308c\u3060\u3051\u3002<br \/>\nboost::asio\u3092\u8981\u6c42\u3059\u308b\u305f\u3081\u3001FIND_PACKAGE\u3067\u30d1\u30c3\u30b1\u30fc\u30b8\u63a2\u3057\u305f\u308a\u3001boost::asio\u304c\u8981\u6c42\u3059\u308b\u30e9\u30a4\u30d6\u30e9\u30ea\u304cOS\u3054\u3068\u306b\u9055\u3063\u3066\u3044\u308b\u3051\u3069\u3001\u305d\u3053\u306fIF\u3067\u5206\u5c90\u3057\u3066FIND_LIBRARY\u3067\u63a2\u3057\u3066\u3084\u308c\u3070OK\u3002<br \/>\ncygwin\u3060\u3051\u4f55\u304b\u3057\u305f\u3044\u5834\u5408\u306f\u3001\u300cIF (CYGWIN)\uff5eENDIF(CYGWIN)\u300d\u3067\u3044\u3044\u3063\u307d\u3044\u3002<br \/>\n\u8a2d\u5b9a\u6b21\u7b2c\u3067\u306f\u30a4\u30f3\u30b9\u30c8\u30fc\u30e9\u30fc\u3082\u4f5c\u308c\u308b\u307f\u305f\u3044\u3002<br \/>\n\u3053\u3063\u3061\u306f\u3061\u3087\u3063\u3068\u3084\u3084\u3053\u3057\u3044\u3051\u3069\u3001Windows\u306a\u3089NSIS\u304c\u3001Linux\u7cfb\u306a\u3089DEB\u304c\u4f5c\u308c\u308b\u3089\u3057\u3044\u3002<br \/>\n\u30d3\u30eb\u30c9\u3059\u308b\u3068\u304d\u306b\u3001\/build\u3092\u4f5c\u3063\u3066\u3001cd\u3002cmake ..\u3063\u3066\u3084\u308b\u3068\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u30d5\u30a1\u30a4\u30eb\u3082\u30ea\u30f3\u30af\u6e08\u307f\u30d0\u30a4\u30ca\u30ea\u3082\/build\u4ee5\u4e0b\u306b\u3067\u304d\u308b\u304b\u3089\u3001<\/p>\n<pre><code class=\"\" data-line=\"\">SET(CPACK_SOURCE_IGNORE_FILES  &quot;\/build\/&quot; &quot;\/.svn\/&quot; &quot;\/.deps\/&quot; &quot;\/.settings\/&quot; &quot;.cproject&quot; &quot;.project&quot;)<\/code><\/pre>\n<p>\u3067\u30d1\u30c3\u30af\u6307\u5b9a\u304b\u3089\u5916\u3057\u3066\u3084\u308c\u3070\u3001make package-source\u3067\u30bd\u30fc\u30b9\u30d1\u30c3\u30b1\u30fc\u30b8\u3092\u4f5c\u3063\u3066\u3082\u3001\u4f59\u8a08\u306a\u3082\u306e\u304c\u5165\u3089\u306a\u304f\u3066\u4fbf\u5229\u3002<br \/>\n\u516c\u5f0f\u306eWin32\u30d0\u30a4\u30ca\u30ea\u306f-G\u3067\u6307\u5b9a\u3057\u306a\u3044\u3068Visual Studio\u306esln\u3092\u51fa\u529b\u3057\u3088\u3046\u3068\u3059\u308b\u304b\u3089\u3001MSYS\u3067\u30d3\u30eb\u30c9\u3057\u305f\u3051\u308c\u3070\u3001-G&#8221;MSYS Makefiles&#8221;\u304c\u3044\u308b\u306e\u306b\u6ce8\u610f\u3002<br \/>\nCMakeLists.txt\u3092\u66f8\u304f\u306e\u306a\u3089\u3001vim\u304bEclipse + <a href=\"http:\/\/cmakeed.sourceforge.net\/\">CMakeEd<\/a>\u304c\u4fbf\u5229\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Autotools\u306e\u30b9\u30af\u30ea\u30d7\u30c8\u3092\u66f8\u304f\u306e\u304c\u5927\u5909\u306a\u306e\u3067\u3001CMake\u3092\u5c0e\u5165\u3057\u3066\u307f\u305f\u3002 \u3068\u308a\u3042\u3048\u305a\u3001boost::asio\u306e\u7df4\u7fd2\u3064\u3044\u3067\u306bhttp\u30af\u30e9\u30a4\u30a2\u30f3\u30c8\u3068TCP\u30b5\u30fc\u30d0\u30fc\u3092CMake\u3067\u30d3\u30eb\u30c9\u3002 \u5358\u7d14\u306b\u30d3\u30eb\u30c9\u3059\u308b\u3060\u3051\u306a\u3089\u3001 \/C &hellip; <a href=\"https:\/\/mattyan.net\/blog\/?p=1422\" class=\"more-link\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"screen-reader-text\">CMake\u5c0e\u5165\u4e2d<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[3,1],"tags":[],"class_list":["post-1422","post","type-post","status-publish","format-standard","hentry","category-3","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1422","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1422"}],"version-history":[{"count":0,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1422\/revisions"}],"wp:attachment":[{"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1422"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1422"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattyan.net\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1422"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}