Skip to content

[BUG][CPP-QT] HEADER_FILES variable is not defined in generated cpp-qt CMakeLists.txt #22987

@andrea-masciotta-idsg

Description

@andrea-masciotta-idsg

Description

The generated CMakeLists.txt for the cpp-qt client uses the variable ${HEADER_FILES} in an install() command, but HEADER_FILES is never defined or populated anywhere in the file. This results in the install command being a no-op or potentially causing errors on some CMake invocations.

Relevant lines:

install(
    FILES ${HEADER_FILES}
    DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME}
)

No line in the generated file (or the cpp-qt-client/CMakeLists.txt.mustache template) sets or populates HEADER_FILES.

By contrast, other generators (like cpp-restsdk) define this variable using file(GLOB_RECURSE HEADER_FILES ...).

openapi-generator version

7.20.0

OpenAPI declaration file content or url

https://github.com/OpenAPITools/openapi-generator/tree/master/samples/client/petstore/cpp-qt/client

Generation Details

openapi-generator generate --global-property skipFormModel=false -g cpp-qt-client -i myyaml.yml -o generated/

Steps to reproduce

  1. Generate a client for CPP-QT (e.g., with the petstore sample or other spec).
  2. Inspect the resulting CMakeLists.txt.

Expected vs Actual

Expected: HEADER_FILES should be defined or populated with the headers to be installed.
Actual: HEADER_FILES is undefined.

Suggest a fix

Add a line to globally define HEADER_FILES (for example, using file(GLOB_RECURSE HEADER_FILES "*.h") or enumerating the headers).


Code reference for context:


Example of correct usage in cpp-restsdk:

file(GLOB_RECURSE HEADER_FILES "include/*.h")
file(GLOB_RECURSE SOURCE_FILES "src/*.cpp")
add_library(${PROJECT_NAME} ${HEADER_FILES} ${SOURCE_FILES})

This ensures all header files are collected and can be installed as needed.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions