Skip to content

cnruby/w3h1_cmake

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Where are The 'CMake' Commands from? "basic_104"

TABLE of CONTENTS

1 Prerequisite

### install rust
# run the follow command if you install not rust
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
# select 1 and enter
# open new terminal
### end install rust
### install ripgrep
cargo install ripgrep
### end install ripgrep

2 What are the types of The 'CMake' Command?

  • From a software perspective, two broad categories of CMake and Generator commands
  • From a functional perspective, several general types of commands, such as create generator, build and install program

3 How to Use the 'CMake' Command?

  • image
  • image

4 Where are The 'CMake' Commands from?

4.1 Get The Project

git clone https://github.com/cnruby/w3h1_cmake.git basic_104
cd basic_104
git checkout basic_104

4.2 Create and Build the Project

cmake -GNinja -Bbuild/
cmake --build build/ --verbose

4.3 Show the 'CMake' Command Help

cmake --help | more

4.4 Search the 'CMake' Command by Help

# cmake -B build/ -G Ninja
cmake --help | rg '\-B'
cmake --help | rg '\-G'
# cmake --build build/ --verbose
cmake --help | rg '\-\-build'
cmake --help | rg '\-\-verbose'

4.5 Show the 'CMake' Command Other Helps

cmake --help | rg '\-E'
cmake -E
cmake --install
cmake --build
# common command
# cmake --build build/ --verbose
# Build target 'clean' first, then build.
# cmake --build build/ --target clean
# cmake --build build/
cmake --build build/ --clean-first

4.6 Show the 'CMake' Command with Build Helps

cmake --build build/ --target clean
## help??
cmake --build build/ --target
# build tasks
cmake --build build/ --target help
# generator usage help
cmake --build build/ --target --help

5 General Commands

5.1 Commands with '--build'

cmake --build build/
cmake --build build/ -j 4
cmake --build build/ --clean-first -j 4
cmake --build build/ --verbose --clean-first -j 4
cmake --build build/ --target all
cmake --build build/ --clean-first --verbose

5.2 Commands with 'config'

#  None Debug Release RelWithDebInfo MinSizeRel ...
ccmake build/ -DCMAKE_BUILD_TYPE=MinSizeRel
cmake build/ -DCMAKE_BUILD_TYPE=RelWithDebInfo
cmake build/ -DCMAKE_VERBOSE_MAKEFILE=ON