主要是使用CMake生成的VS2010的工程,最好不要直接拷貝,最好的方法還是把給的那個CMake工程放入到適合的工程下,然后再重新Cmake生成,這樣可能會減少路徑出錯的可能性。
下面是https://cmake.org/Bug/view.php?id=9042中給出的問題描寫,說CMake的相對路徑是1個bug
Hi all,
I noticed that eventhough the CMAKE_USE_RELATIVE_PATH is set to ON,
the Program Database File name (.pdb) in the .vcproj still uses an
absolute path.However, all other paths in the *.vcproj seem to use relative paths.
Regards,
上面說明問題的版本是2.8版本的,后來查看最新版本3.4的release notes發(fā)現(xiàn):
The CMAKE_USE_RELATIVE_PATHS variable no longer has any effect. Previously it was partially implemented and unreliable.
說,先前只是實現(xiàn)了部份的相對路徑,而且不可靠。所以,華麗麗的敗了,不要試圖嘗試了,只能浪費時間。最好的解決方案,還是依照我上面提到的那種方法去配置好了。
注:
關于相對路徑,有時不太肯定’.’所代表確當前路徑究竟是在哪?這個時候可以利用在VS2010的include選項編輯,輸入’.’后面就會自動輸出當前路徑下文件和文件夾,這樣就肯定了。【僅供參考】