what to write in cmakelists.txt to force build 64 bit exe

To force a 64-bit build in CMake, you can add the following lines to your CMakeLists.txt file:

set(CMAKE_GENERATOR_PLATFORM x64)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SUBSYSTEM:WINDOWS,6.01 /MACHINE:X64")

The first line sets the generator platform to x64, which tells CMake to generate 64-bit build files. The second line sets the linker flags for the executable, which sets the subsystem to windows and specifies the machine type as x64.

posted @ 2023-03-23 22:49  SpacetimeCoding  阅读(102)  评论(0)    收藏  举报