mirror of
https://github.com/adambard/learnxinyminutes-docs.git
synced 2025-01-17 05:28:37 +01:00
Some grammar, vocabulary improvements
This commit is contained in:
parent
9c6084c33e
commit
60c213a37a
@ -6,25 +6,25 @@ contributors:
|
|||||||
filename: CMake
|
filename: CMake
|
||||||
---
|
---
|
||||||
|
|
||||||
CMake is a cross-platform, open-source build system. This tool will allow you
|
CMake is a cross-platform, open-source build system. This tool allows you to test,
|
||||||
to test, compile and create packages of your source code.
|
compile, and create packages of your source code.
|
||||||
|
|
||||||
The problem that CMake tries to solve is the problem of Makefiles and
|
The problem that CMake tries to solve is the problem of Makefiles and
|
||||||
Autoconfigure on cross-platforms (different make interpreters have different
|
Autoconfigure on cross-platforms (different make interpreters have different
|
||||||
command) and the ease-of-use on linking 3rd party libraries.
|
commands) and the ease-of-use on linking 3rd party libraries.
|
||||||
|
|
||||||
CMake is an extensible, open-source system that manages the build process in
|
CMake is an extensible, open-source system that manages the build process in
|
||||||
an operating system and compiler-independent manner. Unlike many
|
an operating system and compiler-agnostic manner. Unlike many
|
||||||
cross-platform systems, CMake is designed to be used in conjunction with the
|
cross-platform systems, CMake is designed to be used in conjunction with the
|
||||||
native build environment. Simple configuration files placed in each source
|
native build environment. Simple configuration files placed in each source
|
||||||
directory (called CMakeLists.txt files) are used to generate standard build
|
directory (called CMakeLists.txt files) are used to generate standard build
|
||||||
files (e.g., makefiles on Unix and projects/workspaces in Windows MSVC) which
|
files (e.g., makefiles on Unix and projects/workspaces in Windows MSVC) which
|
||||||
are used in the usual way.
|
are used in the usual way.
|
||||||
|
|
||||||
```cmake
|
```cmake
|
||||||
# In CMake, this is a comment
|
# In CMake, this is a comment
|
||||||
|
|
||||||
# To run our code, we will use these steps:
|
# To run our code, please perform the following commands:
|
||||||
# - mkdir build && cd build
|
# - mkdir build && cd build
|
||||||
# - cmake ..
|
# - cmake ..
|
||||||
# - make
|
# - make
|
||||||
@ -45,22 +45,22 @@ cmake_minimum_required (VERSION 2.8)
|
|||||||
# Raises a FATAL_ERROR if version < 2.8
|
# Raises a FATAL_ERROR if version < 2.8
|
||||||
cmake_minimum_required (VERSION 2.8 FATAL_ERROR)
|
cmake_minimum_required (VERSION 2.8 FATAL_ERROR)
|
||||||
|
|
||||||
# We setup the name for our project. After we do that, this will change some
|
# We define the name of our project, and this changes some directories
|
||||||
# directories naming convention generated by CMake. We can send the LANG of
|
# naming convention generated by CMake. We can send the LANG of code
|
||||||
# code as second param
|
# as the second param
|
||||||
project (learncmake C)
|
project (learncmake C)
|
||||||
|
|
||||||
# Set the project source dir (just convention)
|
# Set the project source dir (just convention)
|
||||||
set( LEARN_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
|
set( LEARN_CMAKE_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR} )
|
||||||
set( LEARN_CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
|
set( LEARN_CMAKE_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} )
|
||||||
|
|
||||||
# It's useful to setup the current version of our code in the build system
|
# It's useful to set up the current version of our code in the build system
|
||||||
# using a `semver` style
|
# using a `semver` style
|
||||||
set (LEARN_CMAKE_VERSION_MAJOR 1)
|
set (LEARN_CMAKE_VERSION_MAJOR 1)
|
||||||
set (LEARN_CMAKE_VERSION_MINOR 0)
|
set (LEARN_CMAKE_VERSION_MINOR 0)
|
||||||
set (LEARN_CMAKE_VERSION_PATCH 0)
|
set (LEARN_CMAKE_VERSION_PATCH 0)
|
||||||
|
|
||||||
# Send the variables (version number) to source code header
|
# Send the variables (version number) to the source code header
|
||||||
configure_file (
|
configure_file (
|
||||||
"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
|
"${PROJECT_SOURCE_DIR}/TutorialConfig.h.in"
|
||||||
"${PROJECT_BINARY_DIR}/TutorialConfig.h"
|
"${PROJECT_BINARY_DIR}/TutorialConfig.h"
|
||||||
@ -127,14 +127,14 @@ if(FALSE AND (FALSE OR TRUE))
|
|||||||
message("Don't display!")
|
message("Don't display!")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Set a normal, cache, or environment variable to a given value.
|
# Set a regular, cache, or environment variable to a given value.
|
||||||
# If the PARENT_SCOPE option is given the variable will be set in the scope
|
# If the PARENT_SCOPE option is given, the variable will be set in the scope
|
||||||
# above the current scope.
|
# above the current scope.
|
||||||
# `set(<variable> <value>... [PARENT_SCOPE])`
|
# `set(<variable> <value>... [PARENT_SCOPE])`
|
||||||
|
|
||||||
# How to reference variables inside quoted and unquoted arguments
|
# How to reference variables inside quoted and unquoted arguments?
|
||||||
# A variable reference is replaced by the value of the variable, or by the
|
# A variable reference is replaced by either the variable value or by the
|
||||||
# empty string if the variable is not set
|
# empty string if the variable is not set.
|
||||||
${variable_name}
|
${variable_name}
|
||||||
|
|
||||||
# Lists
|
# Lists
|
||||||
@ -172,6 +172,7 @@ endif()
|
|||||||
|
|
||||||
### More Resources
|
### More Resources
|
||||||
|
|
||||||
+ [cmake tutorial](https://cmake.org/cmake-tutorial/)
|
+ [CMake tutorial](https://cmake.org/cmake-tutorial/)
|
||||||
+ [cmake documentation](https://cmake.org/documentation/)
|
+ [CMake documentation](https://cmake.org/documentation/)
|
||||||
+ [mastering cmake](http://amzn.com/1930934319/)
|
+ [Mastering CMake](http://amzn.com/1930934319/)
|
||||||
|
+ [An Introduction to Modern CMake](https://cliutils.gitlab.io/modern-cmake/)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user