2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Visual Studio 2019 で Cmake + C++ プロジェクトを設定する CMakeSettings.json のメモ

Last updated at Posted at 2019-11-22

背景

Visual Studio 2019 では CMake のサポートが強化されたようで, GUI からいろいろ設定できるようになっている.
CMake のパッケージのインストールは必要.
(Generator Ninja も自動で入るっぽい?)

cmake bootstrap

フォルダを開くか, git repo を clone すると, CMakeLists.txt があると自動で cmake bootstrap が走るようになります.
(なにかしら .sln ファイルを用意して開く必要はない)

いままでは, たとえば git for Windows の shell(mintty bash)で batch ファイル動かすなどで .sln 生成対応していましたが, この手間が減ります.

(cmd //c vcsetup.bat と mintty bash で実行すると, Windows コマンドプロンプトで batch file を動かしてくれる)

CMakeSettings.json

SwiftShader でこの機能を知りました.

cmake bootstrap のための設定を, CMakeSettings.json で保存して利用することができます.

いろいろ頑張れば MinGW ビルドも VC2019 でできます.

CMakeSettings.json を VC editor で開くと, GUI で設定 or JSON editor で構文チェックしながら記述ができるので便利ですが, ただ, 出始めの機能なのか, あまり OSS で使っているサンプルが無いですね.

オフィシャルにちらりと設定サンプルはありました.

TODO

  • Ninja だと, コンパイルエラー時にエラーメッセージをクリックしても GUI でソースコードの該当場所に飛んでくれない模様なので, 通常の VC Generator を試す.
2
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?