Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] CMake generator: create targets for package executables #9033

Closed
1 task done
n-morales opened this issue May 31, 2021 · 4 comments · Fixed by #16964
Closed
1 task done

[feature] CMake generator: create targets for package executables #9033

n-morales opened this issue May 31, 2021 · 4 comments · Fixed by #16964

Comments

@n-morales
Copy link
Contributor

Currently there doesn't seem to be a good way to access executable targets of a package dependency in the CMake generator. For example, the glslang package provides a library but also a compiler that can be used by a dependent package.

Currently conan generates targets for each package library target (e.g. CONAN_LIB::<package_name>-<target-name>) but not for executables. This means the only way to get the actual executable is through CMake's find_program feature. This seems to defeat the point of using a package manager for dependencies in the first place.

@memsharded
Copy link
Member

Hi @n-morales

Yes, we are gradually adding support for better modeling for executables, for example 1.37 now has added some experimental support for generated xxxx-config.cmake files for build_requires that contains executables. Please check that the supported CMake integration in Conan 2.0 will be the new one in CMakeDeps and CMakeToolchain.

We have also tried to add explicit cpp_info.exes field in the cpp_info information for a while.

Note, however, that for many cases you don't need the CMake target, and it might be more convenient to use it directly from the recipe (I find more convenient to script there than in CMakeLists), as the executables will be in the path, so they can directly be used.

I am labeling this as an accepted feature request, but might not get priority right now, but for Conan 2.0.

@memsharded
Copy link
Member

Sorry this never got prioritized enough and Conan 2.0 is imminent.
Moving this to the 2.X backlog, to be addressed after 2.0 release.

@n-morales
Copy link
Contributor Author

Sorry this never got prioritized enough and Conan 2.0 is imminent. Moving this to the 2.X backlog, to be addressed after 2.0 release.

I have workarounds currently, but would be great to see this down the line!

@memsharded memsharded modified the milestones: 2.0, 2.X Feb 17, 2023
@memsharded
Copy link
Member

Conan 2.9 introduced a new CMakeDeps generator that generate targets for executables: #16964

It is in dev-state at the moment, enabled with -c tools.cmake.cmakedeps:new=will_break_next (the value changes in every release to guarantee dev-status and not usable in production until we get enough feedback).

I am closing this ticket as solved, feedback very welcome, please create new tickets for any feedback or issue related to this new CMakeDeps generator, many thanks!

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

Successfully merging a pull request may close this issue.

2 participants