cmake and cmake-gui读的环境变量不一致

在配OpenNI2的时候, 导出变量到~/.bashrc后, 发现cmake和cmake-gui读出的变量不一致,

仔细一看cmake读的变量是从~/.bashrc文件里面的读的
cmake-gui是从~/.profile文件里面读的

可以在cmake文件里面加入

execute_process(
    COMMAND ${CMAKE_COMMAND} -E environment
)

看细节

注意source命令对.profile文件不起作用, 得log out才行.

(

After changing the .profile file, you have to logout from your account and login, then it will be sourced once automatically.

Also make sure these file does not exist in your home directory:

~/.bash_profile
~/.bash_login
If you’ve got these files, the .profile will be ignored.

)

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章