Variables are explicitly defined
Variables are implicitly defined
internal variable
To use yes, use the set command to assign values.
for example:
set(CMAKE_BUILD_TYPE "Debug")
CMAKE_C_COMPILER | Specify the C compiler |
CMAKE_CXX_COMPILER | |
CMAKE_C_FLAGS | Options when compiling C files, such as -g; you can also add compilation options through add_definitions |
EXECUTABLE_OUTPUT_PATH | Executable file storage path |
LIBRARY_OUTPUT_PATH | library file path |
CMAKE_BUILD_TYPE | build 类型(Debug, Release, ...),CMAKE_BUILD_TYPE=Debug |
BUILD_SHARED_LIBS | Generate shared library |
BUILD_LIBS | Generate static library |
CMAKE_BINARY_DIR |
The same, the path where cmake is located. (Generally, we create a new build, then cd into it, and then cmake .., this path is build) (Generally, we hope that the things generated by cmake are in a separate folder, which means here) |
PROJECT_BINARY_DIR | |
<projectname>_BINARY_DIR | |
CMAKE_SOURCE_DIR |
The same, it means the top-level directory of the project. (The difference from the above is that this path is outside the build, which generally refers to the file path where the source code is located). |
PROJECT_SOURCE_DIR |
|
<projectname>_SOURCE_DIR |
|
variable reference
Use ${} for example:
${CMAKE_BINARY_DIR}