CMake2-变量4-常用内置变量7:CMAKE_CURRENT_LIST_DIR【当前*.cmake文件所在路径】

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.

  1. CMAKE_SOURCE_DIR:整个CMake工程最顶层的CMakeLists.txt文件所在路径。
  2. CMAKE_CURRENT_SOURCE_DIR:当前CMakeLists.txt文件所在路径。
  3. CMAKE_CURRENT_LIST_DIR:当前*.cmake文件所在路径。
  4. CMAKE_BINARY_DIR: 构建目录的顶层路径。
  5. CMAKE_CURRENT_BINARY_DIR:构建当前CMakeLists.txt文件所在路径。
  6. CMAKE_INSTALL_PREFIX:执行make install命令时安装的根目录的路径。
  7. CMAKE_MODULE_PATH:find_package的module模式时,Find<PackageName>.cmake文件所在路径。
  8. CMAKE_PREFIX_PATH: CMake的环境变量,存放CMake的搜索路径列表,可提供给find_package(), find_program(), find_library(), find_file(), 和find_path()等函数使用。




CMAKE_CURRENT_LIST_DIR — CMake 3.27.9 Documentation

CMake之CMake常用变量说明_cmake进行配置时,prefix、path和dir-CSDN博客 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值