# hello-cmake **Repository Path**: oudream/hello-cmake ## Basic Information - **Project Name**: hello-cmake - **Description**: cmake's hello world, example, demo - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2022-05-23 - **Last Updated**: 2023-02-09 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README --- # Git clone - git clone https://github.com/oudream/hello-cmake --recursive # usage - (en) In order to facilitate the single or functional test, #add_subdirectory (xxx), most of which are closed, open the relevant subdirectory to test according to your own needs. - (cn) 为了方便平常做单体或功能性试验,#add_subdirectory(xxx),这些大部分都在关闭状态,根据自身需要打开相关子目录来试验。 # help - [https://cmake.org/cmake/help/latest/index.html](https://cmake.org/cmake/help/latest/index.html) - [https://cmake.org/cmake/help/latest/guide/tutorial/index.html](https://cmake.org/cmake/help/latest/guide/tutorial/index.html) - [man](./man) - [cmake v3.13 documents ](./man/documentation) # hello code - [independent other project, direct cmake . ->](./hello/independent) - [cmake lang test ->](./build/cmake/hello/lang) - [gen target by auto scan source code ->](./build/cmake/hello/musc/mult1) # install cmake ```bash sudo -i version=3.10 build=2 cd /tmp mkdir cmake cd cmake wget https://cmake.org/files/v$version/cmake-$version.$build.tar.gz tar -xzf cmake-$version.$build.tar.gz cd cmake-$version.$build/ ./bootstrap make -j4 make install ``` # [https://cmake.org/cmake/help/latest/](https://cmake.org/cmake/help/latest/) # cmake命令行 - [https://cmake.org/cmake/help/latest/manual/cmake.1.html](https://cmake.org/cmake/help/latest/manual/cmake.1.html) - [https://cmake.org/cmake/help/latest/manual/ctest.1.html](https://cmake.org/cmake/help/latest/manual/ctest.1.html) - [https://cmake.org/cmake/help/latest/manual/cpack.1.html](https://cmake.org/cmake/help/latest/manual/cpack.1.html) ```bash git clone https://github.com/oudream/hello-cmake cd hello-cmake cmake . -DCMAKE_BUILD_TYPE=Debug --build . -B"./build-" ``` - [cmake命令行](#cmake%e5%91%bd%e4%bb%a4%e8%a1%8c) - [1.1. 用法](#11-%e7%94%a8%e6%b3%95) - [1.2. OPTIONS](#12-options) - [1.3. 生成器](#13-%e7%94%9f%e6%88%90%e5%99%a8) - [命令行](#%e5%91%bd%e4%bb%a4%e8%a1%8c) ## 1.1. 用法 帮助: ```powershell --help,-help,-usage,-h,-H,/? = Print usage information and exit. --version,-version,/V [] = Print version number and exit. --help-full [] = Print all help manuals and exit. --help-manual [] = Print one help manual and exit. --help-manual-list [] = List help manuals available and exit. --help-command [] = Print help for one command and exit. --help-command-list [] = List commands with help available and exit. --help-commands [] = Print cmake-commands manual and exit. --help-module [] = Print help for one module and exit. --help-module-list [] = List modules with help available and exit. --help-modules [] = Print cmake-modules manual and exit. --help-policy [] = Print help for one policy and exit. --help-policy-list [] = List policies with help available and exit. --help-policies [] = Print cmake-policies manual and exit. --help-property [] = Print help for one property and exit. --help-property-list [] = List properties with help available and exit. --help-properties [] = Print cmake-properties manual and exit. --help-variable var [] = Print help for one variable and exit. --help-variable-list [] = List variables with help available and exit. --help-variables [] = Print cmake-variables manual and exit. ``` `cmake [options] ` `cmake [options] ` `cmake [options] -S -B ` ## 1.2. OPTIONS - `-G ` 指定生成器,详见[生成器](#13-%e7%94%9f%e6%88%90%e5%99%a8) - 举例:`cmake .. -G "Visual Studio 15 2017 Win64"` - `-D [:]=` 创建或更新cmake变量 - `-E` CMake 命令行模式,通过cmake -E --help查看. - `--build ` 编译指定目录 - 举例:`cmake --build . --target ALL_BUILD --config Release` - `--` 传递其他参数给本地工具 - `--debug-output` 输出debug信息,打印命令由哪一行调用 - `-H. -Bbuild` 等价于 `mkdir -p build ; cd build ; cmake .. - `-P