Cmake-构建概念
构建基本的概念:读懂别人的工程,做到局部的理解
Johhny Rade
年青
展开
-
cmake-00-refference
本文整理自 Github 【cmake example from trroy】 Github 【cmake cookbook from dev-cafe】 随笔: 20世纪人类建立了三个无与伦比的概念:“字节”,“基因”,“原子”翻译 2021-05-13 17:01:53 · 88 阅读 · 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 · 100 阅读 · 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 · 145 阅读 · 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 · 280 阅读 · 0 评论 -
cmake-04-installer
cmake_minimum_required(VERSION 3.5) project(cmake_examples_deb) # set a project version set (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 · 88 阅读 · 0 评论 -
cmake-05-3ppPackage
find_package cmake helper cmake installer itself may include some tools (FindXX.cmake) to help check 3pp installed on host manualy install 3pp c++ lib , boost #install 3pp package boost sudo apt-get install libboost-all-dev use case on boost cmake_翻译 2021-05-12 15:53:15 · 162 阅读 · 0 评论 -
cmake-06-unitTests
unitTest ctest + 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 · 396 阅读 · 0 评论 -
cmake-07-staticAnalysis
1. 静态分析 涵盖功能 Out of bounds errors Memory leaks Usage of uninitialized variables Use of unsafe functions 具体工具 (每一个都可能支持以上多数功能) valgrind cppcheck clang-Static-Analyzer clan-Format 2. Valgrind # use system installed valgrind tool cmake_minimum_re翻译 2021-05-13 09:52:03 · 102 阅读 · 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 · 128 阅读 · 0 评论 -
cmake-09-customCommand
execute_process cmake_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 functions set(_module_name "cffi") execute_proce翻译 2021-05-13 10:40:03 · 217 阅读 · 0 评论 -
cmake-10-codeGeneration
Method configure time + configure_file cmake_minimum_required(VERSION 3.10 FATAL_ERROR) project(recipe-01 LANGUAGES Fortran C) # Get username execute_process( COMMAND whoami TIMEOUT 1 OUTPUT_VARIABLE _user_name OUTPUT_STRIP_TRAILING_W翻译 2021-05-13 15:44:14 · 170 阅读 · 0 评论 -
cmake-11-cmakeSyntax
macro add_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 · 111 阅读 · 0 评论
分享