linuxcmake

get the system home directory in CMake on Linux?


What variable is related to the home_dir (like /home/user) of a Linux system in CMake?

What are other easy ways to get it?


Solution

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

    $ENV{HOME}