a bit late to the party but it may help people landing on this page with the same issue.
I had a similar problem trying integrate conan 2 into my CMake workflow so wrote a CMake module to invoke (and even install, if needed) conan, possibly depending on CMake options or variables. It is available from https://github.com/tkhyn/cmake-conanfile. It requires a conanfile.py
and doesn't work with conanfile.txt
but the conversion is easy enough.