windowscmakeonnxruntime

CMake '--install' installs wrong configuration


I've built ONNX Runtime for Windows from scratch by cloning https://github.com/microsoft/onnxruntime and running the build.bat script. It successfully called down to CMake and compiled and generated a bunch of files into the build/Windows/RelWithDebInfo directory.

Now I want to install the library to my system.

I'm used to the Linux world where there is usually a Makefile and then I can run sudo make install.

I've ran cmake --install . from the RelWithDebInfo directory, but this produced

cmake --install .
-- Install configuration: "Release"
CMake Error at cmake_install.cmake:36 (file):
  file cannot create directory: C:/Program
  Files/onnxruntime/include/onnxruntime.  Maybe need administrative
  privileges.

This is strange because the configuration is wrong. It's not supposed to be "Release" it's supposed to be "RelWithDebInfo."

How to install proper configuration?


Solution

  • You configure the project for Visual Studio generator, which is multi-configuration one. Because of that, it is pretty irrelevant what name has the directory with your build files (build/Windows/RelWithDebInfo): this directory contains build files sufficient for build the project in any configuration (supported by the project).

    For install a specific configuration of the project with cmake --install just pass appropriate --config parameter:

      cmake --install . --config RelWithDebInfo