UNIXでは、C/C++のソースコードをビルドするにはMakefileを書いてmakeツールを使うのが一般的です。しかし、Makefileを書くのは大変なので*1、もっと楽なツールを探すと出てくるものの一つがcmakeです*2。 cmakeのインストール(CentOS 5.2) # yum install cmake でインストールできます。 Hello, worldプログラムをcmakeでビルドする ビルド設定は、CMakeLists.txtという名前のファイルに記述します。とりあえずソースファイルと同じディレクトリに以下の内容で作成します。 CMakeLists.txtの作成 PROJECT(HelloWorld) ADD_EXECUTABLE(hello hello.cpp) cmakeコマンド実行 以下コマンドを実行します。 hello$ cmake . -- Check for
SCons SConsはmakeやAntのように数多くあるビルドツールのうち一つであり、Pythonで書かれている。 ビルド設定のファイルをPythonで記述することができ、またSCons自身が依存関係解析の機能を持っているため、 makeと比べるとずっと簡単にビルド環境を構築することができる。 Hello, World的なもの 以下のような簡単なCプログラムをSConsでビルドしてみる。 hello.c 1 #include <stdio.h> 2 int main (int argc, char *argv[]) { 3 printf("Hello, World!\n"); 4 return 0; 5 } 6
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く