Skip to content
Advertisement

Can I get the system home directory in CMake on Linux?

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.

Advertisement

Answer

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

$ENV{HOME}
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement