Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 12111

Integrate openapi-generate with Conan 2 and CMake with proper caching

$
0
0

I am trying to integrate multiple OpenApi definitions that I generate with the openapi-generator into my Conan 2 and CMake based project.

I currently have a somewhat working version, but the OpenAPI stubs get rebuild unconditionally during every Conan build even if the OpenAPI YML files have not changed. I think there must be a better solution that uses the cached generated files if the inputs did not change.

I would mainly like to understand if I should call the openapi-generator from Conan or from CMake and how I can achive a more efficient integration.

Currently I am doing roughly the following:

  1. Add a tool dependency in conan: tool_requires = "openapi-generator/6.6.0"
  2. Call self.run(f"openapi-generator generate -i ... -o ... -g cpprest-sdk <other options>") from the build method before I run cmake.build().

Should I move the generation steps into CMake or is it correct to handle this from Conan? Is there a better way to generate the implementation so that Conan (or CMake) can reuse previously generated files?


Viewing all articles
Browse latest Browse all 12111

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>