2017年2月25日土曜日

Hello CMake

前提条件

CMakeのインストール

環境

Ubuntu 16.04.2 LTS (32bit)

Sauce

ディレクトリを作成
$ mkdir hello-cmake

hello-cmake/CMakeLists.txt
cmake_minimum_required (VERSION 3.6)
project (HelloCMake)
add_executable(HelloCMake main.cpp)

hello-cmake/main.cpp
#include <iostream>
int main() {
    std::cout << "Hello CMake" << std::endl;
}

Build

Build用のディレクトリ(tmp)を作成
$ mkdir tmp
$ cd tmp
$ cmake ../hello-cmake/

$ make

実行

$ ./HelloCMake
Hello CMake

参考:https://cmake.org/cmake-tutorial/
Sample:https://github.com/yoshihiro-kato/Sample

0 件のコメント:

コメントを投稿