2017-02-23 76 views
0

我想使用CMake Tools extension在Visual Studio代碼中開發一個CMake項目。爲一些選項配置CMake的Visual Studio代碼

我建立在命令行中的項目,下面的命令:

PS project\build> cmake -G"Visual Studio 14 2015 Win64" -DBOOST_ROOT=some\path -DQT_ROOT=another\path\ project\path 

如何設置與在.cmaketools.json文件,我的.vscode文件夾下已經相同的選項相同的命令?我想從編輯器中運行它,如果可能,還要指定輸出文件夾,而不是在我的項目中創建一個build文件夾。

這是我的實際.cmaketools.json

{ 
    "variant": { 
    "label": "Debug", 
    "keywordSettings": { 
     "buildType": "debug" 
    }, 
    "description": "Emit debug information without performing optimizations" 
    }, 
    "activeEnvironments": [ 
    "Visual C++ 14.0 - amd64" 
    ] 
} 
+0

我在問什麼不清楚? – Jepessen

回答

2

.vscode\.cmaketools.json文件只有 「空間緩存」 Visual Studio代碼的 - CMake的工具擴展。見他們的code

/** 
* The workspace cache stores extension state that is convenient to remember 
* between executions. Things like the active variant or enabled environments 
* are stored here so that they may be recalled quickly upon extension 
* restart. 
*/ 

我想你想要的是一個.vscode\settings.json與例如描述here以下內容:

{ 
    "cmake.generator": "Visual Studio 14 2015 Win64", 
    "cmake.configureSettings": { "BOOST_ROOT": "some/path", "QT_ROOT": "another/path" } 
} 
+0

現在感謝它的工作。 – Jepessen