Full directory of the listfile currently being processed.
As CMake processes the listfiles in your project this variable will always be set to the directory where the listfile which is currently being processed (CMAKE_CURRENT_LIST_FILE) is located. The value has dynamic scope. When CMake starts processing commands in a source file it sets this variable to the directory where this file is located. When CMake finishes processing commands from the file it restores the previous value. Therefore the value of the variable inside a macro or function is the directory of the file invoking the bottom-most entry on the call stack, not the directory of the file containing the macro or function definition.
See also CMAKE_CURRENT_LIST_FILE.
- CMAKE_SOURCE_DIR:整个CMake工程最顶层的CMakeLists.txt文件所在路径。
- CMAKE_CURRENT_SOURCE_DIR:当前CMakeLists.txt文件所在路径。
- CMAKE_CURRENT_LIST_DIR:当前*.cmake文件所在路径。
- CMAKE_BINARY_DIR: 构建目录的顶层路径。
- CMAKE_CURRENT_BINARY_DIR:构建当前CMakeLists.txt文件所在路径。
- CMAKE_INSTALL_PREFIX:执行make install命令时安装的根目录的路径。
- CMAKE_MODULE_PATH:find_package的module模式时,Find<PackageName>.cmake文件所在路径。
- CMAKE_PREFIX_PATH: CMake的环境变量,存放CMake的搜索路径列表,可提供给find_package(), find_program(), find_library(), find_file(), 和find_path()等函数使用。