Windows default CMAKE_INSTALL_PREFIX is wrong?

Can anyone explain why the default prefix for Windows has (x86) in it,

//Install path prefix, prepended onto install directories.
CMAKE_INSTALL_PREFIX:PATH=C:/Program Files (x86)/{project name}

even though I have a 64 bit compiler active. As I understand it, 64-bit exes should go into c:\Program Files\

> cl /?
Microsoft (R) C/C++ Optimizing Compiler Version 19.44.35219 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

The manual says

* Added in version 3.29: If the CMAKE_INSTALL_PREFIX environment variable is set, its value is used as default for this variable.
* c:/Program Files/${PROJECT_NAME} on Windows.

I am using cmake 4.1.1 on Windows 11.

Is there a way to default it to the correct value? (I know it can be set manually)

Thanks.

An example file:

cmake_minimum_required(VERSION 3.10)

project(Ind C)

Run cmake -B _build and you will see the default install setting in _build\CMakeCache.txt

Specify -A x64 to explicitly configure a 64-bit executable with VS, although this does seem to be a confusion about defaults as without -A it clearly generates a 64-bit executable/project.

1 Like

Thanks for the swift reply. Specifying -A x64 as you suggest does set the correct install path.