How to retrieve a user environment variable in CMake (Windows)

后端 未结 4 442
长情又很酷
长情又很酷 2020-12-07 13:46

I know how to retrieve a normal machine wide environment variable in CMAKE using

$ENV{EnvironmentVariableName}

but I can not retrieve a use

4条回答
  •  北荒
    北荒 (楼主)
    2020-12-07 14:32

    Environment variables (that you modify using the System Properties) are only propagated to subshells when you create a new subshell.

    If you had a command line prompt (DOS or cygwin) open when you changed the User env vars, then they won't show up.

    You need to open a new command line prompt after you change the user settings.

    The equivalent in Unix/Linux is adding a line to your .bash_rc: you need to start a new shell to get the values.

提交回复
热议问题