CMake---基础练习2
2024-08-27 03:41:14
# t2/ CMakeLists.txt cmake_minimum_required(VERSION 2.8) #1
#PROJECT (HELLO)
#SET(SRC_LIST main.c)
#MESSAGE(STATUS "This is BINARY dir" ${HELLO_BINARY_DIR})
#MESSAGE(STATUS "This is SOURCE dir" ${HELLO_SOURCE_DIR})
#ADD_EXECUTABLE(hello ${SRC_LIST}) #2
#PROJECT(HELLO)
#ADD_EXECUTABLE(hello main.c) PROJECT(HELLO)
ADD_SUBDIRECTORY(src bin)
//main.c #include <stdio.h>
int main()
{
printf("Hello World from t1 Main!\n "); return ;
}
# t2/src/CMakeLists.txt ADD_EXECUTABLE(hello main.c)
u@u160406:~/learn_Cmake/cmake/t2$ ls
build CMakeLists.txt src
u@u160406:~/learn_Cmake/cmake/t2$ tree
.
├── build
├── CMakeLists.txt
└── src
├── CMakeLists.txt
└── main.c directories, files
u@u160406:~/learn_Cmake/cmake/t2$ cd build
u@u160406:~/learn_Cmake/cmake/t2/build$ cmake ..
-- The C compiler identification is GNU 5.4.
-- The CXX compiler identification is GNU 5.4.
-- 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: /home/u/learn_Cmake/cmake/t2/build
u@u160406:~/learn_Cmake/cmake/t2/build$ make
Scanning dependencies of target hello
[ %] Building C object bin/CMakeFiles/hello.dir/main.c.o
[%] Linking C executable hello
[%] Built target hello
u@u160406:~/learn_Cmake/cmake/t2/build$ cd bin
u@u160406:~/learn_Cmake/cmake/t2/build/bin$ ./hello
Hello World from t1 Main!
u@u160406:~/learn_Cmake/cmake/t2/build/bin$
最新文章
- 用HTML5 CANVAS做自定义路径的动态效果图片!
- HDU5322 Hope(DP + CDQ分治 + NTT)
- 安装恢复Windows10各种坑
- GIT(分布式版本控制系统)
- Effective C++ 1.让自己习惯C++
- windows条件下,Ping加上时间戳,并保存到文件,适用于测试网络
- PHP也20岁了
- u-boot移植为tiny6410步骤
- android中GridView关于间距的属性值介绍
- 四校训练 warm up 14
- C++调用DLL有两种方法——静态调用和动态调用
- 分享5个主流的HTML5开发工具
- myeclipse连接hadoop集群编程及问题解决
- mybatis系列笔记(1)---mybatis入门
- [SinGuLaRiTy] 树形存储结构阶段性测试
- 『Asp.Net 组件』Asp.Net 服务器组件 内嵌图片:自己的图片控件
- Jquery 在子页面上设置父页面元素的值
- 使用Java面向对象单词必备
- TopCoder SRM502 Div1 500 贪心 01背包
- 为什么用VUE,而不用Jquery了?