首页 > 其他 > 详细

CMake-单个源文件

时间:2020-04-08 16:37:36      阅读:57      评论:0      收藏:0      [点我收藏+]

单个源文件的比较简单,直接在源文件的同一目录下编写CMakeLists.txt,然后执行cmake ..,之后会得到Makefile文件,直接make就能得可执行文件。

main.c

1 #include<stdio.h>
2 
3 int main()
4 {
5     printf("hello world");
6     return 0;
7 }

CMakeLists.txt

 1 # Set the minimum version of CMake that can be used
 2 # To find the cmake version run
 3 # $ cmake --version
 4 cmake_minimum_required(VERSION 2.8.12)
 5 
 6 # Set the project name
 7 project (hello)
 8 
 9 # Add an executable
10 add_executable(hello_cmake main.c)

 

CMake-单个源文件

原文:https://www.cnblogs.com/njit-sam/p/12660176.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!