cmake的使用--从零建立一个小cmake工程
A minimal project
代碼倉庫地址
https://github.com/zzu-andrew/linux-sys/tree/dfew/CMake # 說明最低cmake版本要求 cmake_minimum_required(VERSION 3.2) # 工程名 project(MyApp) # 可執行程序名 add_executable(myExe main.cpp)支持添加多個文件
add_executable(myExemain.cppsrc1.cppsrc2.cpp )命令不區分大小寫
add_executable(myExe main.cpp) ADD_EXECUTABLE(myExe main.cpp) Add_Executable(myExe main.cpp)可只填寫主版本和次版本
cmake_minimum_required(VERSION major.minor[.patch[.tweak]])每個CMake工程都應該包含一個project()命令,該命令應該在cmake_minimum_required()命令之后調用。雖然能只給一個工程名,但是最好給出工程的版本信息,方便其他模塊能夠調用
project(projectName[VERSION major[.minor[.patch[.tweak]]]][LANGUAGES languageName ...] )The optional LANGUAGES argument defines the programming languages that should be enabled for the project. Supported values include C, CXX, Fortran, ASM, Java and others. If specifying multiple languages, separate each with a space. In some special situations, projects may want to indicate that no languages are used, which can be done using LANGUAGES NONE.
If no LANGUAGES option is provided, CMake will default to C and CXX.
CMake versions prior to 3.0 do not support the LANGUAGES keyword, but languages can still be specified after the project name using the older form of the command like so:
project(myProj C CXX)總結
以上是生活随笔為你收集整理的cmake的使用--从零建立一个小cmake工程的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 基于公开数据的特殊人群在线活动特征挖掘
- 下一篇: 数博会重磅活动:第二届大数据科学与工程国