ファイルを用意
#include <stdio.h>
int
main(int argc, char *argv[])
{
printf("hello world\n");
return 0;
}
cmake_minimum_required(VERSION 2.8)
project(hoge)
add_executable(a.out main.c)
実行
mkdir build
cd build
cmake ..
-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /data/cmake/build
結果
- buildディレクトリに以下のファイルが生成される
build
|-- CMakeCache.txt
|-- CMakeFiles
| |-- 3.10.2
| | |-- CMakeCCompiler.cmake
| | |-- CMakeCXXCompiler.cmake
| | |-- CMakeDetermineCompilerABI_C.bin
| | |-- CMakeDetermineCompilerABI_CXX.bin
| | |-- CMakeSystem.cmake
| | |-- CompilerIdC
| | | |-- CMakeCCompilerId.c
| | | |-- a.out
| | | `-- tmp
| | `-- CompilerIdCXX
| | |-- CMakeCXXCompilerId.cpp
| | |-- a.out
| | `-- tmp
| |-- CMakeDirectoryInformation.cmake
| |-- CMakeOutput.log
| |-- CMakeTmp
| |-- Makefile.cmake
| |-- Makefile2
| |-- TargetDirectories.txt
| |-- a.out.dir
| | |-- DependInfo.cmake
| | |-- build.make
| | |-- cmake_clean.cmake
| | |-- depend.make
| | |-- flags.make
| | |-- link.txt
| | `-- progress.make
| |-- cmake.check_cache
| |-- feature_tests.bin
| |-- feature_tests.c
| |-- feature_tests.cxx
| `-- progress.marks
|-- Makefile
`-- cmake_install.cmake
8 directories, 29 files
- 基本的な使い方は分かった
- あとは、静的ライブラリを作成する方法を後日やる