Skip to content

[BUG] [CMake] Package config references a non-existent header: cmake/NvInferVersion.h #40

Description

@patrikhuber

Describe the bug

cmake/TensorRT-RTXConfig.cmake adds a header file set to TRTRTX::tensorrt_headers with a file that the package
does not contain:

  target_sources(TRTRTX::tensorrt_headers
    INTERFACE
      FILE_SET "HEADERS"
      TYPE "HEADERS"
      BASE_DIRS "${_IMPORT_PREFIX}/cmake"
      FILES "${_IMPORT_PREFIX}/cmake/NvInferVersion.h"
  )

NvInferVersion.h is only in include/. CMake 4.3 reports the missing file at generate time when a file API client
requests the code model. Visual Studio does this on every configure.

Steps to reproduce

  1. Extract TensorRT-RTX-1.6.1.120-Windows-amd64-cuda-13.4-Release-external. Create an empty
    bin/tensorrt_player.exe in it, or find_package fails earlier on a different missing file (see [CMake] Windows package config references missing bin/tensorrt_player.exe (tensorrt_capture_player) TensorRT#4851).

  2. Create a folder with this CMakeLists.txt, with <package> set to the extracted directory:

     cmake_minimum_required(VERSION 3.27)
     project(trt_probe LANGUAGES CXX)
     set(TensorRT-RTX_DIR "<package>/cmake")
     find_package(CUDAToolkit REQUIRED)
     find_package(TensorRT-RTX CONFIG REQUIRED)
     file(WRITE "${CMAKE_BINARY_DIR}/main.cpp" "int main() {}\n")
     add_executable(probe "${CMAKE_BINARY_DIR}/main.cpp")
     target_link_libraries(probe PRIVATE TRTRTX::tensorrt)
    
  3. Open the folder in Visual Studio 2026 Insiders (18.10, bundled CMake 4.3.1) with File > Open > Folder. The CMake
    configure runs automatically. The Output window (CMake) shows:

     CMake Error in CMakeLists.txt:
       Cannot find source file:
         <package>/cmake/NvInferVersion.h
    

To reproduce on the command line instead: Visual Studio requests the CMake code model through the file API, and the
error only appears with that request. Write {"requests":[{"kind":"codemodel","version":2}]} to
build/.cmake/api/v1/query/client-x/query.json, then run cmake -S . -B build -G Ninja with CMake 4.3.1. CMake
4.2.3, and CMake 4.3.1 without the query, do not report the error.

Expected behavior

The file set uses BASE_DIRS "${_IMPORT_PREFIX}/include" and FILES "${_IMPORT_PREFIX}/include/NvInferVersion.h".
TensorRT-Enterprise 11.3.0.99 already does this: its header file set lists include/ headers, and the same repro
reports no error.

Environment

  • TensorRT-RTX version: 1.6.1.120
  • GPU: NVIDIA RTX 3500 Ada Generation Laptop GPU (driver 596.86)
  • Operating system: Windows 11 Pro 10.0.26200
  • CUDA version: 13.3 (toolkit 13.3.73)
  • CPU architecture: x86_64

Screenshots

N/A

Additional context

  • The same issue was present in TensorRT-Enterprise 11.2.1.2 and it was fixed in 11.3.0.99.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions