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.

)

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