This is included in Windows 11.
Downlevel: In Microsoft Store, Install "App Installer" (aka winget)
Winget Repo: microsoft/winget-cli: Windows Package Manager CLI (aka winget)
Package Repo: microsoft/winget-pkgs: The Microsoft community Windows Package Manager manifest repository
winget install 'Git.Git'
git.exe config --global user.email '[email protected]'
git.exe config --global user.name 'Your Name'
Found here -- under "All Downloads", expand "Tools for Visual Studio.
Invoke-WebRequest -Uri 'https://aka.ms/vs/17/release/vs_BuildTools.exe' -OutFile "$env:TEMP\vs_BuildTools.exe"
& "$env:TEMP\vs_BuildTools.exe" --passive --wait --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --remove Microsoft.VisualStudio.Component.VC.CMake.Project
Note: Build Tools includes CMake, but it won't be in the path if Developer Tools command window isn't open, so we'll install separately. In addition, the website CMake is newer.
Note: It would be nice to use " winget install 'Microsoft.VisualStudio.2022.BuildTools' ", but that installs C# tools, not C++ tools. See this bug
winget.exe install 'Kitware.CMake'
Note: Installing to `/vcpkg`` to make it easy to access vcpkg.exe, and reduce path lengths.
git.exe clone https://github.com/microsoft/vcpkg /vcpkg
\vcpkg\scripts\bootstrap.ps1 -disableMetrics
winget.exe install 'Python.Python.3.11'
pip.exe install 'cmake-format'
e.g.,
cmake-format.exe --line-width 100 --tab-size 4 --max-subgroups-hwrap 2 --max-pargs-hwrap 3 --separate-ctrl-name-with-space true --separate-fn-name-with-space true --dangle-parens false --line-ending windows --command-case lower --keyword-case upper --enable-markup false -i CMakeLists.txt
Arguments read from ".cmake-format.json"
pip.exe install 'clang-format'
Arguments read from ".clang-format"
winget.exe install 'Cppcheck.Cppcheck'
winget.exe install 'DimitriVanHeesch.Doxygen'
Poco docs here
\vcpkg\vcpkg.exe search poco
\vcpkg\vcpkg.exe install poco --triplet x64-windows
Note: Ensure you specify triplet for the target platform. You can install multiple triplets, and choose which to build against later.
Note: x64-windows
builds x64-windows-dbg
and x64-windows-rel
.
mkdir ~/Repos/md5-vcpkg
Set-Location ~/Repos/md5-vcpkg
cmake_minimum_required(VERSION 3.5.0)
project(MD5Encrypter)
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_CXX_STANDARD_REQUIRED ON)
find_package(Poco REQUIRED Foundation)
add_executable(md5 md5.cpp)
# For static linked EXE, add the following:
#
# if(MSVC)
# add_compile_options(
# $<$<CONFIG:>:/MT>
# $<$<CONFIG:Debug>:/MTd>
# $<$<CONFIG:Release>:/MT>
# )
# endif()
#
# Note that dependent DLLs (pcre2-8.dll, zlib1.dll) are still required.
target_link_libraries(md5 PRIVATE PRIVATE Poco::Foundation)
#include "Poco/MD5Engine.h"
#include "Poco/DigestStream.h"
#include <iostream>
int main(int argc, char **argv)
{
// https://docs.pocoproject.org/current/Poco.MD5Engine.html
Poco::MD5Engine md5;
// https://docs.pocoproject.org/current/Poco.DigestOutputStream.html
Poco::DigestOutputStream ds{md5};
ds << "abcdefghijklmnopqrstuvwxyz";
ds.close();
// https://docs.pocoproject.org/current/Poco.DigestEngine.html
std::cout << Poco::DigestEngine::digestToHex(md5.digest()) << std::endl;
return 0;
}
Note: you don’t need to run any of this in a Visual Studio developer command window.
Set-Location ~/Repos/md5-vcpkg
cmake.exe -DCMAKE_TOOLCHAIN_FILE:FILEPATH='\vcpkg\scripts\buildsystems\vcpkg.cmake' -DVCPKG_TARGET_TRIPLET=x64-windows -S . -B build --graphviz='build\graphviz.dot'
Note: CMAKE_TOOLCHAIN_FILE is the key to getting cmake to use the vcpkg environment.
Note: VCPKG_TARGET_TRIPLET specifies what libraries to use.
Note: ":FILEPATH" suffix helps cmake to deal with paths on Windows, especially in PowerShell
Note: "--graphviz" argument will generate a .DOT file for GraphViz
cmake.exe --build build --config RelWithDebInfo --clean-first
Open build\graphviz.dot in Visual Studio, and choose "Graphviz: Toggle Preview"
.\build\RelWithDebInfo\md5.exe
C3fcd3d76192e4007dfb496cca67e13b