CMake configuration files in release assets `onnxruntime-*.tgz` are problematic

Describe the issue

CMake configuration files in release assets onnxruntime-*.tgz are problematic.

To reproduce

Download a release from GitHub

wget https://github.com/microsoft/onnxruntime/releases/download/v1.23.0/onnxruntime-linux-x64-1.23.0.tgz

Please note that this issue is not specific to v1.23.0, x64 and Linux. onnxruntime-linux-x64-1.23.0.tgz is used here only as an example.

Extract the release

mkdir /tmp/onnxruntime
tar xzf onnxruntime-linux-x64-1.23.0.tgz --strip-components=1 -C /tmp/onnxruntime

Use the release in a CMake project

Create CMakeLists.txt with the following content:

cmake_minimum_required(VERSION 3.16)

project(example LANGUAGES CXX)

list(APPEND CMAKE_PREFIX_PATH /tmp/onnxruntime)

find_package(onnxruntime CONFIG REQUIRED)

add_executable(example main.cpp)
target_link_libraries(example PRIVATE onnxruntime::onnxruntime)

Create main.cpp with the following content:

Configure the project:

mkdir build && cd build
cmake ..

Expected behavior

The project should be configured successfully.

Actual behavior

CMake Error at /tmp/onnxruntime/lib/cmake/onnxruntime/onnxruntimeTargets.cmake:83 (message):
  The imported target "onnxruntime::onnxruntime" references the file

     "/tmp/onnxruntime/lib64/libonnxruntime.so.1.23.0"

  but this file does not exist.  Possible reasons include:

  * The file was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and contained

     "/tmp/onnxruntime/lib/cmake/onnxruntime/onnxruntimeTargets.cmake"

  but not all the files it references.

Call Stack (most recent call first):
  /tmp/onnxruntime/lib/cmake/onnxruntime/onnxruntimeConfig.cmake:26 (include)
  CMakeLists.txt:7 (find_package)

I tried:

ln -s /tmp/onnxruntime/lib /tmp/onnxruntime/lib64

but another error occurred:

CMake Error in CMakeLists.txt:
  Imported target "onnxruntime::onnxruntime" includes non-existent path

    "/tmp/onnxruntime/include/onnxruntime"

  in its INTERFACE_INCLUDE_DIRECTORIES.  Possible reasons include:

  * The path was deleted, renamed, or moved to another location.

  * An install or uninstall procedure did not complete successfully.

  * The installation package was faulty and references files it does not
  provide.

Urgency

No response

Platform

Linux

OS Version

Not relevant

ONNX Runtime Installation

Released Package

ONNX Runtime Version or Commit ID

Reproducible with multiple recent releases

ONNX Runtime API

C++

Architecture

X64

Execution Provider

Default CPU

Execution Provider Library Version

No response