背景
- window系統(tǒng)vs2017使用cmake實現(xiàn)linux遠(yuǎn)程調(diào)試和編譯時,搭建的環(huán)境報
CMake 缺少以下功能:“serverMode”。請參閱 https://aka.ms/linuxcmakeconfig 了解詳細(xì)信息
錯誤,如何解決? - 經(jīng)排查,發(fā)現(xiàn)遠(yuǎn)程開發(fā)環(huán)境的cmake版本不支持serverMode模式,因此,無法實現(xiàn)遠(yuǎn)程編譯
解決方案
-
驗證遠(yuǎn)程目標(biāo)服務(wù)器的cmake支持的能力,執(zhí)行以下命令:
cmake -E capabilities
-
輸出結(jié)果如下:
{“fileApi”:{“requests”:[{“kind”:“codemodel”,“version”:[{“major”:2,“minor”:3}]},{“kind”:“cache”,“version”:[{“major”:2,“minor”:0}]},{“kind”:“cmakeFiles”,“version”:[{“major”:1,“minor”:0}]},{“kind”:“toolchains”,“version”:[{“major”:1,“minor”:0}]}]},“generators”:[{“extraGenerators”:[],“name”:“Watcom WMake”,“platformSupport”:false,“toolsetSupport”:false},{“extraGenerators”:[],“name”:“Ninja Multi-Config”,“platformSupport”:false,“toolsetSupport”:false},{“extraGenerators”:[“CodeBlocks”,“CodeLite”,“Eclipse CDT4”,“Kate”,“Sublime Text 2”],“name”:“Ninja”,“platformSupport”:false,“toolsetSupport”:false},{“extraGenerators”:[“CodeBlocks”,“CodeLite”,“Eclipse CDT4”,“Kate”,“Sublime Text 2”],“name”:“Unix Makefiles”,“platformSupport”:false,“toolsetSupport”:false},{“extraGenerators”:[],“name”:“Green Hills MULTI”,“platformSupport”:true,“toolsetSupport”:true}],“serverMode”:false,“version”:{“isDirty”:false,“major”:3,“minor”:21,“patch”:1,“string”:“3.21.1”,“suffix”:“”}} -
可以看到參數(shù)serverMode為false,因此遠(yuǎn)程編譯失敗,如何將參數(shù)置為true?除了換cmake的版本,目前沒有想到其他的解決辦法,我嘗試從相同版本cmake使用源碼編譯的方式,去尋找與之相關(guān)聯(lián)的參數(shù),但均嘗試失敗。目前在centos系統(tǒng)下,3.17.1的版本該模式為true,而3.21則不行文章來源:http://www.zghlxwxcb.cn/news/detail-666581.html
-
注意事項:文章來源地址http://www.zghlxwxcb.cn/news/detail-666581.html
- 如何目標(biāo)服務(wù)器有多個版本的cmake,在本地的
CMakeSettings.json
文件中"cmakeExecutable"字段可以指定使用哪個cmake - 其他變量參數(shù)應(yīng)盡可能使用絕對路徑,避免使用類似于
$HOME
等宏定義變量,防止于windows的環(huán)境變量沖突
- 如何目標(biāo)服務(wù)器有多個版本的cmake,在本地的
參考文獻
- https://learn.microsoft.com/zh-cn/cpp/linux/cmake-linux-configure?view=msvc-170
- https://learn.microsoft.com/zh-cn/cpp/build/get-started-linux-cmake?view=msvc-170
到了這里,關(guān)于vs2017實現(xiàn)linux遠(yuǎn)程編譯報錯“CMake 缺少以下功能:serverMode“解決方案的文章就介紹完了。如果您還想了解更多內(nèi)容,請在右上角搜索TOY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!