首页 > 其他 > 详细

cmake

时间:2019-06-05 10:05:30      阅读:101      评论:0      收藏:0      [点我收藏+]

1.cmake_minimum_required(VERSION 3.7.1) cmake最低版本

2.project

Sets the name of the project, and stores it in the variable PROJECT_NAME. When called from the top-level CMakeLists.txt also stores the project name in the variable CMAKE_PROJECT_NAME.

3.set(SOURCE_FILES main.c)

SOURCE_FILES代替文件main.c

4.message(STATUS "This is BINARY dir " ${PROJECT_BINARY_DIR})

${PROJECT_BINARY_DIR}:CMakeLists.txt所在目录,在终端会打印如下内容:

This is BINARY dir /home/zzz/WorkSpace/Program/learning-cmake/hello-world

5.add_executable(hello-world ${SOURCE_FILES})

hello-world:最后生成可执行文件名称

6.add_subdirectory(src)

添加一个子目录去编译

7.add_library(hello_dynamic SHARED ${LIBHELLO_SRC}

用源文件生成动态库

8.add_library(hello_static STATIC ${LIBHELLO_SRC}

用源文件生成静态库

 

cmake

原文:https://www.cnblogs.com/aelite/p/10977185.html

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