what is preset's installDir

I am switching to presets and can’t figure out how to use installDir. Is it the same or different than CMAKE_INSTALL_PREFIX? I have "installDir": "out/${presetName}" , but it still tries to install to the default CMAKE_INSTALL_PREFIX on my platform .

How to use installDir correctly?

Which version are you specifying in your preset file?

From https://cmake.org/cmake/help/latest/manual/cmake-presets.7.html#configure-preset

This is allowed in preset files specifying version 3 or above.

I am using preset version 3, my CMake is 3.22.1

@McMartin , it looks like presets are completely ignored when invoking cmake --install. How installDir option in the preset is supposed to work?

OMG, I made it work. It wasn’t very not intuitive, cmake-presets doc doesn’t mention any of it.

For those who’ll come here in the future, trick is to run both configure AND build from the source dir, unlike other CMake workflows.

  1. First configure: cmake -S . --preset xxx
  2. Then install without changing directory: cmake --build --preset xxx --target install
2 Likes