OpenAPITools / OpenAPITools/openapi-generator
[BUG][CPP-QT] HEADER_FILES variable is not defined in generated cpp-qt CMakeLists.txt
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 26.8k
- Forks
- 7.7k
- PR merge metrics
- PR metrics pending
Description
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
- Generate a client for CPP-QT (e.g., with the petstore sample or other spec).
- 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with modules/openapi-generator/src/main/resources/cpp-qt-client/CMakeLists.txt.mustache and compare its header handling with the referenced cpp-restsdk sample. Regenerate the petstore cpp-qt client, inspect the resulting CMakeLists.txt, and verify that the install step receives the generated headers.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100