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] CONAN_RUNTIME_LIB_DIRS for CMakeDeps #17018

Closed
1 task done
FeignClaims opened this issue Sep 18, 2024 · 4 comments · Fixed by #16964
Closed
1 task done

[feature] CONAN_RUNTIME_LIB_DIRS for CMakeDeps #17018

FeignClaims opened this issue Sep 18, 2024 · 4 comments · Fixed by #16964
Assignees
Milestone

Comments

@FeignClaims
Copy link

What is your suggestion?

Hi! I'm adding a feature to automatically install conan runtimes in a cmake library aminya/project_options#279. Since the usage of conan is optional, the repo chooses to use cmake-conan. However, CONAN_RUNTIME_LIB_DIRS is set by CMakeToolchain while cmake-conan could only supports CMakeDeps, so I couldn't install runtimes when using cmake-conan.

I would like to have some way to collect CONAN_RUNTIME_LIB_DIRS when only CMakeDeps is specified.

Have you read the CONTRIBUTING guide?

  • I've read the CONTRIBUTING guide
@memsharded
Copy link
Member

Thanks for your suggestion @FeignClaims

There are some challenges in defining these kind of variables in CMakeDeps generators, because they are very focused on the find_package() and target interfaces. But I am adding this to the next 2.9 for having a look to see if something can be done.

@jcar87
Copy link
Contributor

jcar87 commented Sep 19, 2024

We can probably define this variable in cmake-conan, I think it would make sense to have it.
@memsharded - the implementation would actually be very similar to the solution for conan-io/cmake-conan#669

@memsharded memsharded self-assigned this Oct 21, 2024
@memsharded
Copy link
Member

I am adding this variable to the new conan_cmakedeps_paths.cmake generated by the new CMakeDeps in #16964 (which will close this ticket, then it needs to be completed in cmake-conan)

@memsharded
Copy link
Member

We are releasing in Conan 2.9 a completely new CMakeDeps generator in #16964 that has closed this ticket, with many pending features and fixes:

  • Allow defining cpp_info.default_components and using that information to generate CMake targets by default for packages
  • Allow defining cpp_info.exe to model executable imported targed generation
  • Creating always actual SHARED/STATIC/INTERFACE imported targets, with their IMPORTED_LOCATION, the IMPORTED_IMPLIB, the IMPORTED_CONFIGURATIONS
  • This solves issues with try_compile and other CMake source-compiling checks
  • No artificial library or package targets
  • Allow using the package languages attribute or a new cpp_info.languages information to define IMPORTED_LINK_INTERFACE_LANGUAGES
  • Define config files for executable targets for the "build" context automatically, without any special configuration
  • Use the correct CONFIGURATION from the package instead of the consumer one
  • Generate a new conan_cmakedeps_paths.cmake file, that can be used for integrations that cannot use a CMakeToolchain, like cmake-conan, this will contain the CONAN_RUNTIME_LIB_DIRS variable
  • Allow using executable targets from the host context if not cross-building (and not tool-requires that would prioritize those executable targets)

Current known pending functionality (to be added soon):

  • Not managing Apple frameworks
  • Not generating find modules, only CMake Config files

The new CMakeDeps generator is intended for testing and validation only, being a transparent replacement of the old one, so it is behind a new conf. To use it, use the -c tools.cmake.cmakedeps:new=will_break_next, and that will use the new generator instead of the old one. Note the will_break_next value means exactly that, that value will change in next release to force a break, so no one can depend on this generator in production yet.

Your feedback is very important

As this is a major change, we will only remove the conf gate when we get confirmation from users that it works and solve the issues. Please try the new generator for your project, and let us know if it works. If it doesn't, please re-open this ticket and let us know what failed. Thanks very much!

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

Successfully merging a pull request may close this issue.

3 participants