Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@n-suudai
Last active May 1, 2022 08:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n-suudai/ebcfacc455d48d863c7585d225ca818a to your computer and use it in GitHub Desktop.
Save n-suudai/ebcfacc455d48d863c7585d225ca818a to your computer and use it in GitHub Desktop.
CMakeインストールの自動化サンプル
@echo off
setlocal
set CURRENT_DIR=%~dp0
pushd %CURRENT_DIR%
set TARGET_DIR=%CURRENT_DIR%
set CMAKE_VERSION=3.23.1
set CMAKE_ARCHIVE_NAME=cmake-%CMAKE_VERSION%-windows-x86_64
set CMAKE_PATH=%TARGET_DIR%\%CMAKE_ARCHIVE_NAME%\bin
@rem CMakeインストール確認
if exist %CMAKE_PATH% (
goto :CMAKE_INSTALLED
)
@rem zipダウンロード
bitsadmin /RawReturn /TRANSFER getfile ^
https://github.com/Kitware/CMake/releases/download/v%CMAKE_VERSION%/%CMAKE_ARCHIVE_NAME%.zip ^
%TARGET_DIR%\%CMAKE_ARCHIVE_NAME%.zip
@rem zip展開
powershell Expand-Archive -Path %CMAKE_ARCHIVE_NAME%.zip -DestinationPath %TARGET_DIR%
@rem zip削除
del %CMAKE_ARCHIVE_NAME%.zip
@rem バージョン確認
:CMAKE_INSTALLED
%CMAKE_PATH%\cmake.exe --version
popd
endlocal
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment