我可以在Linux上的CMake中获取系统主目录吗?

我可以在Linux上的CMake中获取系统主目录吗?

问题描述:

在CMake中是否存在与Linux系统的home_dir(例如/home/user)相关的变量.或其他一些简单的方法来获取它.

Is there a variable related to the home_dir(like /home/user) of Linux system in CMake. Or some other easy ways to get it.

主目录由 HOME 环境变量引用,因此您可以通过以下方式在CMake脚本中访问它:

Home directory is referred to by the HOME environment variable, so you can access it in CMake script by:

$ENV{HOME}