Cmake-构建概念
构建基本的概念:读懂别人的工程,做到局部的理解
Johhny Rade
年青
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
cmake-00-refference
本文整理自Github 【cmake example from trroy】Github 【cmake cookbook from dev-cafe】随笔:20世纪人类建立了三个无与伦比的概念:“字节”,“基因”,“原子”翻译 2021-05-13 17:01:53 · 120 阅读 · 0 评论 -
cmake-01-basic
project Basic # a basic CMakeLists.txt # set minimum cmake version cmake_minimum_required(VERSION 3.5) # set project name project(hello-world) #elf file will be hello_elf, sourcefile should be hello-world.c add_executable(hello_elf hello-world.c)翻译 2021-05-10 17:48:36 · 126 阅读 · 0 评论 -
cmake-02-hostcheck
check hostOS cmake_minimum_required(VERSION 3.5 FATAL_ERROR) # project name, in this case no language required project(recipe-01 LANGUAGES NONE) # print custom message depending on the operating system if(CMAKE_SYSTEM_NAME STREQUAL "Linux") mes翻译 2021-05-11 11:02:13 · 184 阅读 · 0 评论 -
cmake-03-CompilerOption
load and check compiler cmake_minimum_required(VERSION 3.5 FATAL_ERROR) # project name and language, load c and cxx compiler project(recipe-06 LANGUAGES C CXX) message(STATUS "Is the C++ compiler loaded? ${CMAKE_CXX_COMPILER_LOADED}") if(CMAKE_CXX翻译 2021-05-10 17:53:40 · 338 阅读 · 0 评论 -
cmake-04-installer
cmake_minimum_required(VERSION 3.5)project(cmake_examples_deb)# set a project versionset (deb_example_VERSION_MAJOR 0)set (deb_example_VERSION_MINOR 2)set (deb_example_VERSION_PATCH 2)set (deb_example_VERSION "${deb_example_VERSION_MAJOR}.${deb_exa翻译 2021-05-11 11:20:30 · 116 阅读 · 0 评论 -
cmake-05-3ppPackage
find_packagecmake helpercmake installer itself may include some tools (FindXX.cmake) to help check 3pp installed on hostmanualy install 3pp c++ lib , boost#install 3pp package boostsudo apt-get install libboost-all-devuse case on boostcmake_翻译 2021-05-12 15:53:15 · 200 阅读 · 0 评论 -
cmake-06-unitTests
unitTestctest + manual ut test(no test suite) cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-01 LANGUAGES CXX) # require C++11 set(CMAKE_CXX_STANDARD 11) set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_STANDARD_REQUIRED ON) #require翻译 2021-05-12 17:23:53 · 451 阅读 · 0 评论 -
cmake-07-staticAnalysis
1. 静态分析涵盖功能Out of bounds errorsMemory leaksUsage of uninitialized variablesUse of unsafe functions具体工具 (每一个都可能支持以上多数功能)valgrindcppcheckclang-Static-Analyzerclan-Format2. Valgrind# use system installed valgrind toolcmake_minimum_re翻译 2021-05-13 09:52:03 · 156 阅读 · 0 评论 -
cmake-08-Condition
User option # use lib or use source : use lib by default(OFF) cmake_minimum_required(VERSION 3.5 FATAL_ERROR) project(recipe-04 LANGUAGES CXX) # introduce a toggle for using a library set(USE_LIBRARY OFF) #print a message during cmake message(翻译 2021-05-10 18:01:23 · 167 阅读 · 0 评论 -
cmake-09-customCommand
execute_processcmake_minimum_required(VERSION 3.5 FATAL_ERROR)project(recipe-02 LANGUAGES NONE)find_package(PythonInterp REQUIRED)# this is set as variable to prepare# for abstraction using loops or functionsset(_module_name "cffi")execute_proce翻译 2021-05-13 10:40:03 · 254 阅读 · 0 评论 -
cmake-10-codeGeneration
Methodconfigure time + configure_filecmake_minimum_required(VERSION 3.10 FATAL_ERROR)project(recipe-01 LANGUAGES Fortran C)# Get usernameexecute_process( COMMAND whoami TIMEOUT 1 OUTPUT_VARIABLE _user_name OUTPUT_STRIP_TRAILING_W翻译 2021-05-13 15:44:14 · 216 阅读 · 0 评论 -
cmake-11-cmakeSyntax
macroadd_executable(cpp_test test.cpp)target_link_libraries(cpp_test sum_integers)macro(add_catch_test _name _cost) math(EXPR num_macro_calls "${num_macro_calls} + 1") message(STATUS "add_catch_test called with ${ARGC} arguments: ${ARGV}") set(_翻译 2021-05-13 16:53:34 · 140 阅读 · 0 评论
分享