title: How to set the CLion build architecture in the CMakeLists.txt file for Visual Studio?
body: <p>In CLion, how can I set the Visual Studio build architecture in the CMakeLists.txt file ? </p>
  
  <p>According to <a href="https://cmake.org/cmake/help/latest/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.html" rel="noreferrer">cmake.org</a>, one can set host=x64 in the CMAKE_GENERATOR_TOOLSET option. </p>
  
  <blockquote>
    <p>The Visual Studio Generators for VS 2013 and above support using
    either the 32-bit or 64-bit host toolchains by specifying a host=x86
    or host=x64 value in the CMAKE_GENERATOR_TOOLSET option. CMake
    provides the selected toolchain architecture preference in this
    variable (x86, x64, or empty).</p>
  </blockquote>
  
  <p>But whatever I do, it has no effect when I click on run in CLion. </p>
  
  <p>CMakeLists.txt:</p>
  
  <pre><code>cmake_minimum_required(VERSION 3.15)
  project(native_data_types)
  
  set(CMAKE_CXX_STANDARD 14)
  
  # http://www.saoe.net/blog/generating-64-bit-projects-for-visual-studio-with-cmake/
  
  
  # https://cmake.org/cmake/help/latest/variable/CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE.html
  # How to set this ?
  
  # set(host "x64")
  # set(CMAKE_VS_PLATFORM_TOOLSET_HOST_ARCHITECTURE "x64")
  # set(CMAKE_GENERATOR_TOOLSET "host=x64")
  
  
  
  # set (native_data_types_ARCHITECTURE "x64")
  # set(BUILD_ARCH "-m64")
  # set(BUILD_ARCH "-m32")
  
  # set(CMAKE_C_FLAGS -m32)
  # set(CMAKE_CXX_FLAGS -m32)
  
  # set(CMAKE_C_FLAGS -m64)
  # set(CMAKE_CXX_FLAGS -m64)
  
  add_executable(native_data_types main.cpp)
  </code></pre>
  
  <p>What I can do is set an additional toolchain in the CLion settings, and set the desired toolchain as the default toolchain, but the encompassing slowness is absolutely horrid and not what I want. <br />
  I want to set the executable architecture in the CMakeLists.txt file, so I can quickly switch, in a second. </p>
  
  <p>For example, on Linux, where I use gcc, I can just set either</p>
  
  <pre><code>set(CMAKE_C_FLAGS -m32)
  </code></pre>
  
  <p>or </p>
  
  <pre><code>set(CMAKE_CXX_FLAGS -m32)
  </code></pre>
  
  <p>But unfortunately, the Visual-Studio-Compiler seems to not have such an option...</p>