Cannot generate 32 bit configuration for Visual Studio 2019 with host=x86 or -A Win32

谁都会走 提交于 2020-07-22 06:13:11

问题


I am trying to configure cmake to build for 32bit and 64bit separately...

So far 64bit is easy as I just need to add -A x64

cmake -G "Visual Studio 16 2019" -A x64

But I am not able to set 32bit arch. Official documentation suggest -A Win32 or -T host=x86
https://cmake.org/cmake/help/latest/generator/Visual%20Studio%2016%202019.html
Even with them I am not able to set x86 host

What I have tried:

cmake -G "Visual Studio 16 2019" -DCMAKE_GENERATOR_PLATFORM=x86

cmake -G "Visual Studio 16 2019" -A Win32

cmake -G "Visual Studio 16 2019" -A Win32 -T host=x86

cmake -G "Visual Studio 16 2019" -A Win32 host=x86

Nothing is working, Here is log I am getting all the time...

-- Selecting Windows SDK version 10.0.18362.0 to target Windows 10.0.18363.
-- The C compiler identification is MSVC 19.25.28612.0
-- The CXX compiler identification is MSVC 19.25.28612.0
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe
-- Check for working C compiler: C:/Program Files (x86)/Microsoft Visual Studio/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/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/2019/Community/VC/Tools/MSVC/14.25.28610/bin/Hostx64/x64/cl.exe

回答1:


It was related to node-js...
I just wrote generator with Win32 and passed arch in node-js part of package.json

npm config set cmake_js_arch ia32 && cmake-js compile cmake -G \"Visual Studio 16 2019\" -A Win32

I am using cmake to build c++ code DLL for a node project, So it is necessary to run it from command line.

cmake-js is a node package for Cmake and that command is telling cmake-js to set arch ia32



来源:https://stackoverflow.com/questions/61506095/cannot-generate-32-bit-configuration-for-visual-studio-2019-with-host-x86-or-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!