金子邦彦研究室インストールWindows の種々のソフトウェア(インストール)GoogleTestのインストール(ソースコードを使用)(Build Tools for Visual Studio を利用)(Windows 上)

GoogleTestのインストール(ソースコードを使用)(Build Tools for Visual Studio を利用)(Windows 上)

前準備

Git のインストール(Windows 上)

Gitは,バージョン管理システム.ソースコードの管理や複数人での共同に役立つ.

サイト内の関連ページ

Windows での Git のインストール: 別ページ »で説明している.

関連する外部ページ

Git の公式ページ: https://git-scm.com/

CMake のインストール(Windows 上)

CMake はビルドツールである.

サイト内の関連ページ

Windows での cmake のインストール: 別ページ »で説明している.

関連する外部ページ

CMake の公式ダウンロードページ: https://cmake.org/download/

Build Tools for Visual Studio 2022 (ビルドツール for Visual Studio 2022),Visual Studio 2022 のインストール(Windows 上)

サイト内の関連ページ

関連する外部ページ

GoogleTest のインストール(Windows 上)

前もって,GoogleTest をインストールするディレクトリを決めておく

このページでは,c:\googletest 下にインストールするものとして説明する.

  1. Windows で,コマンドプロンプト管理者として実行

    コマンドプロンプトを管理者として実行: 別ページ »で説明

  2. 次のコマンドを実行
    cd %HOMEPATH%
    rmdir /s /q googletest
    git clone --recursive https://github.com/google/googletest.git 
    cd googletest
    rmdir /s /q build
    mkdir build
    cd build
    del CMakeCache.txt
    cmake .. -G "Visual Studio 17 2022" -A x64 -T host=x64 ^
        -DCMAKE_INSTALL_PREFIX="c:/googletest" 
    cmake --build . --config RELEASE
    cmake --build . --config RELEASE --target INSTALL -- /m:4
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"GTEST_ROOT\", \"C:\googletest\", \"Machine\")"
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"GTEST_LIBRARY\", \"C:\googletest\lib\", \"Machine\")"
    powershell -command "[System.Environment]::SetEnvironmentVariable(\"GTEST_INCLUDE_DIR\", \"C:\googletest\include\", \"Machine\")"