CMake: How do I specify the target platform?

How do I specify the target platform for CMake? For example x86, x64, amd64. I tried installing TARGET_CPU=x64

but not sure if it works or not.

+3


source to share


1 answer


When calling the command cmake

you can define a generator like Visual Studio 14 2015 Win64 which results in the target x64 platform

cmake -G"Visual Studio 14 2015 Win64" -H%SOURCE_ROOT_DIR% -BC:\build\vs2015\x64\MyProject

      

If you want to build for x86 on Windows with VS2015 - you would go like this:

cmake -G"Visual Studio 14 2015" -H%SOURCE_ROOT_DIR% -BC:\build\vs2015\x64\MyProject

      



ARM

cmake -G"Visual Studio 14 2015 ARM" -H%SOURCE_ROOT_DIR% -BC:\build\vs2015\x64\MyProject

      

Depending on your problem, the CMake toolchain file may help .

+2


source







All Articles