CMAKE_SYSTEM_PROCESSOR not correctly set when using -G "Visual Studio 15 2017" Generator
Compiling for Win32 using Visual Studio 15 2017 has the wrong CMAKE_SYSTEM_PROCESSOR value when using a 64 bit host and 32-bit output. (The default is 32-bit, if you don't explicitly ask for 64-bit)
The C compiler identification is MSVC 19.16.27034.0
The CXX compiler identification is MSVC 19.16.27034.0
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
Detecting C compiler ABI info
Detecting C compiler ABI info - done
Detecting C compile features
Detecting C compile features - done
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe
Check for working CXX compiler: C:/Program Files (x86)/Microsoft Visual Studio/2017/Professional/VC/Tools/MSVC/14.16.27023/bin/Hostx86/x86/cl.exe -- works
Detecting CXX compiler ABI info
Detecting CXX compiler ABI info - done
Detecting CXX compile features
Detecting CXX compile features - done
Looking for MFC
Looking for MFC - found
CMAKE_SYSTEM_PROCESSOR=AMD64
Notice that it's using the 32-bit output compiler, x86/cl.exe. This leads to some problems when trying to use cmake to e.g. include either src/x86/file.cpp or src/x64/file.cpp and in my case set /machine:X86 option to cvtres.
Edited by Anonymous