mcstructs使用CMake生成Makefile文件

CMakeLists.txt

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

执行过程:

[email protected]:~/projects/mcstructs$ cmake .
-- Configuring done
-- Generating done
-- Build files have been written to: /home/merlin/projects/mcstructs
[email protected]:~/projects/mcstructs$ ls
CMakeLists.txt  README.md  src
[email protected]:~/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/mcstructs
[email protected]:~/projects/mcstructs$ ls
CMakeCache.txt  cmake_install.cmake  Makefile   src
CMakeFiles      CMakeLists.txt       README.md
[email protected]:~/projects/mcstructs$ make
Scanning 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.o
Linking C executable mcstructs
[100%] Built target mcstructs
[email protected]:~/projects/mcstructs$ ./mcstructs
++++Micro C Structs(mcstructs) Test utils++++
         merlin<[email protected]>         

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:-3
TEST: Micro C Structs list end.
[email protected]:~/projects/mcstructs$ 
时间: 2024-08-02 07:00:18

mcstructs使用CMake生成Makefile文件的相关文章

cmake利用toolchain.cmake生成makefile之后,make生成静态库失败问题

问题描述 利用toolchian.cmake设置好编译器后,利用make指令生成静态库,出现以下问题 Error running link command: No such file or directory 出错原因,toolchain.cmake文件内没有声明静态库生成器AR:解决方式,在toolchian.cmake文件内添加下面的声明 SET(CMAKE_AR $(TOOLCHAIN_DIR)/bin/arm-linux-gnueabihf-ar CACHE FILEPATH "Arch

自动生成Makefile文件

主要的工具有autoscan, aclocal, autoheader, autoconfig,automake 1 .创建c源文件hello.c 1 #include <stdio.h> 2 3 int main(){ 4 return 0; 5 } 2.执行autoscan命令 这是目录下会多出configure.scan和autoscan.log文件,我们以configure.scan文件为模板进行修改,将configure.scan重命名改为configure.ac (好多博客写的是c

例解 autoconf 和 automake 生成 Makefile 文件

转自:http://www.ibm.com/developerworks/cn/linux/l-makefile/ 引子 无论是在Linux还是在Unix环境中,make都是一个非常重要的编译命令.不管是自己进行项 目开发还是安装应用软件,我们都经常要用到make或 make install.利用make工具,我们可以将大型的开发项目分解成为多个更易于管理的模块,对于一个包括几百个源文件的应用程序,使用make和 makefile工具就可以轻而易举的理顺各个源文件之间纷繁复杂的相互关系. 但是如

利用Makefile.am和Makefile.in生成Makefile文件

1.运行命令 autoscan 生成 configure.scan和configure.log文件,这里如果需要安装autuconf软件包,下载地址http://download.chinaunix.net/download/0001000/648.shtml 下载之后解压 运行命令./configure  这时如果没有安装m4软件包会有错误提示,网上查一下如何安装m4软件包(http://blog.csdn.net/ldl22847/article/details/8575140)这个博客说的

Qt4.8.5 开发环境搭建没有生成makefile文件【编译出现的问题】

安装 Qt 过程中 没有生成makefile文件 [email protected]:~/Qt$ sudo apt-get install libX11-dev libXext-dev libXtst-dev 正在读取软件包列表... 完成正在分析软件包的依赖关系树       正在读取状态信息... 完成       将会安装下列额外的软件包:  libpthread-stubs0 libpthread-stubs0-dev libx11-6 libx11-dev libxau-dev  li

linux下使用automake工具自动生成makefile文件

linux环境下,当项目工程很大的时候,编译的过程很复杂,所以需要使用make工具,自动进行编译安装,但是手写makefile文件比较复杂,所幸在GNU的计划中,设计出了一种叫做Autoconf/Automake的工具,用来自动生成makefile文件,为编译和安装程序提供了一个方便快捷的入口. 一.首先检查是否安装了autotools工具 使用which命令    aclocal    autoscan    autoconf    autoheader    automake 二.安装aut

使用autoscan自动生成makefile文件

本教程使用的是centos7,当前目录下有5个C文件,任务是将他们生成makefile文件 文件内容如下: // add.c int myadd(int a, int b) { return a+b; } // mul.c int mymul(int a, int b) { return a*b; } // div.c int mydiv(int a, int b) { return a/b; } // x.h int myadd(int a, int b); int mymul(int a,

使用automake、autoconf生成MakeFile文件

从helloworld入手 我们从大家最常使用的 例子程序helloworld开始. 下面的 过程如果简单地说来就是 : 新建三个文件: helloworld.c configure.in Makefile.am 然后执行: aclocal; autoconf; automake --add-missing; ./configure; make; ./helloworld 就可以看到Makefile被产生出来,而且可以将helloworld.c编译通过. 很简单吧,几条命令就可以做出一个符合惯例

Cmake生成Makefile

cmake 相比automake 最大的区别是: 步骤没有automake那么多 main.cpp #include<iostream> #include"student.h" using namespace std; int main() { Student stu; stu.set(); stu.display(); cout<<"i am soyo"<<endl; return 0; } student.cpp #inclu