在配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.
)