How to build as an ia32 solution from visual studio using cmake

让人想犯罪 __ 提交于 2021-02-04 21:28:07

问题


I have a module project using cmake with the following configuration:

cmake_minimum_required(VERSION 3.13)
project(app)

set(CMAKE_CXX_STANDARD 11)

add_library(app MODULE src/library.cpp src/library.h)

Once solution generated using cmake .. -G "Visual Studio 15 2017 Win64" -DCMAKE_BUILD_TYPE=Release, I can find an app.sln solution.

I open it with Visual Studio 2019 and click on the button Local Windows Debugger. I can see also a drop-down menu containing the value x64 and an item Configuration Manager.

Why isn't there an ia32 or x86 option by default? I just can't create a new configuration since the configuration is totally non user friendly.

Anyone has an idea for compile the library for target 32 bits programs?

EDIT


I now compile using cmake .. -G "Visual Studio 16 2019" -DCMAKE_GENERATOR_PLATFORM=x86 -DCMAKE_BUILD_TYPE=Release and the project couldn't be even loaded (cuz of some missing configuration on visual studio, that's what the IDE say)


回答1:


It appears from the VS 2019 version of the cmake documentation that you should only need to specify:

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

and I would keep things as simple as possible and let cmake do its job.

Not sure what you mean by "nothing happens" in your last comment. Surely something happened however what happened is not what you expected or wanted.



来源:https://stackoverflow.com/questions/58252285/how-to-build-as-an-ia32-solution-from-visual-studio-using-cmake

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