cmake sample

cmakeの勉強のようなことをした。
参考にしたページはここここである。特に、後者の記事の最後の表は参考になった。
-I, -o, -L, -lとソースファイルを適切なコマンド・手順で指定すると、実行ファイルなり共有ライブラリなりが出力されるツールだ、と解釈するのが多分平和である。

今回cmakeを試しに使ってみるにあたって作ったsampleはここに上げられている。
全て、cmake .; makeでコンパイルできて、shared_libraryのみ、make installが可能である。

githubのCMakeLists.txtのコメントに、cmake自体の説明はまとめられている。

(1) simple_cmake
最も単純なcmakeのサンプル。

(2) full_executable
実用上利用する、フラグ, -D, -I, -o, -L, -lの指定できるサンプル。

(3) shared_library
共有ライブラリを作成するためのサンプル。

本当はサンプル集を作成するためのCMakeLists.txtも作ってみたかったが、今後の課題とする。

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>