首页 > 代码库 > mcstructs使用CMake生成Makefile文件

mcstructs使用CMake生成Makefile文件

 

CMakeLists.txt

project(MCSTRUCTS)set(SRC_LIST src/main.c src/mcslist.c src/mcsringbuf.c)add_executable(mcstructs ${SRC_LIST})

 

执行过程:

merlin@tfAnalysis:~/projects/mcstructs$ cmake .-- Configuring done-- Generating done-- Build files have been written to: /home/merlin/projects/mcstructsmerlin@tfAnalysis:~/projects/mcstructs$ lsCMakeLists.txt  README.md  srcmerlin@tfAnalysis:~/projects/mcstructs$ cmake .-- The C compiler identification is GNU 4.8.2-- The CXX compiler identification is GNU 4.8.2-- 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-- 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-- Configuring done-- Generating done-- Build files have been written to: /home/merlin/projects/mcstructsmerlin@tfAnalysis:~/projects/mcstructs$ lsCMakeCache.txt  cmake_install.cmake  Makefile   srcCMakeFiles      CMakeLists.txt       README.mdmerlin@tfAnalysis:~/projects/mcstructs$ makeScanning dependencies of target mcstructs[ 33%] Building C object CMakeFiles/mcstructs.dir/src/main.c.o[ 66%] Building C object CMakeFiles/mcstructs.dir/src/mcslist.c.o[100%] Building C object CMakeFiles/mcstructs.dir/src/mcsringbuf.c.oLinking C executable mcstructs[100%] Built target mcstructsmerlin@tfAnalysis:~/projects/mcstructs$ ./mcstructs ++++Micro C Structs(mcstructs) Test utils++++         merlin<tfa2012@foxmail.com>         TEST: Micro C Structs list add/delete/find functions:add list header header(0x0804c040)mcs_list_add_item n1(0xbfed9d78) => header(0x0804c040)mcs_list_add_item n2(0xbfed9d90) => header(0x0804c040)mcs_list_add_item n3(0xbfed9da8) => header(0x0804c040)mcs_list_add_item_by_key n4(KEY:2643, 0xbfed9dc0) => header(0x0804c040)mcs_list_add_item_by_key n5(KEY:642, 0xbfed9dd8) => header(0x0804c040)mcs_list_delete_item n2(0xbfed9d90) => header(0x0804c040)mcs_list_delete_item n1(0xbfed9d78) => header(0x0804c040)mcs_list_find_item_by_key KEY:2643(0xbfed9d6c) => header(0x0804c040)mcs_list_delete_item ERROR:-3TEST: Micro C Structs list end.merlin@tfAnalysis:~/projects/mcstructs$ 

 

mcstructs使用CMake生成Makefile文件