This addresses issue #3805 (closed) as follows:
- Remove old detection code for CMake versions older than 2.6.3 to detect
cl_path
. This was hindering CMake from finding the correctcl_path
. - Ensure
cl_path
is defined beforecpp2asm_support.cmake
gets included, such thatml.exe
andml64.exe
for x86 and x64 respectively are found in the correct path. - Specify
cl_path
as a hint when trying to findlib.exe
anddumpbin.exe
. - The Windows SDK that is being used may be installed into
C:\Program Files (x86)\Windows Kits\10
, of which the installation path is covered by a different registry key, namelyHKEY_LOCAL_MACHINE\Software\Microsoft\Windows Kits\Installed Roots\KitsRoot10
. Check if the registry key points to an existing path, and use it askits_dir
if it does and then use that to derive the correctsdk_bindir
. Otherwise fall back to the old method of detectingsdk_bin
andsdk_bindir
. - When MFC is installed, this will try building drstats. Since drstats has hardcoded paths to
Uuid.Lib
, we now simply usekits_dir
to specify the correct path toUuid.Lib
.
I have tested this with Tools for Visual Studio 2019 as follows:
git clone https://github.com/StephanvanSchaik/dynamorio -b i3805-msvc2019
cd dynamorio
mkdir build
cd build
cmake ..
cmd.exe
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\VC\Auxiliary\Build\vcvarsall.bat" amd64
msbuild.exe DynamoRIO.sln
This builds everything successfully. However, do note that you should not have Windows 11 SDK (version 10.0.22000.0) installed. Trying to build DynamoRIO against the Windows 11 SDK will fail with rc.exe emitting error RC2188 due to line 253 in C:\Program Files (x86)\Windows Kits\10\Include\10.0.22000.0\um\winnt.h
. See also: https://bugs.python.org/issue45220 (EDIT: the fix for this is to ensure _AMD64_
or _X86_
are defined when building).