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

Renaming Conan packages #3400

Closed
3 tasks done
uilianries opened this issue Aug 26, 2018 · 8 comments
Closed
3 tasks done

Renaming Conan packages #3400

uilianries opened this issue Aug 26, 2018 · 8 comments

Comments

@uilianries
Copy link
Member

To help us debug your issue please explain:

Hi!

We just released libpq to provide support for PostgreSQL C library, however now we have a new problem...

When a project wants to include postgresql cmake file it looks for FindPostgreSQL.cmake file, but are providing Findlibpq.cmake. As you can see, we need to rename the file, or entry project.

Is there any idea how to fix this situation?

Regards!

  • I've read the CONTRIBUTING guide.
  • I've specified the Conan version, operating system version and any tool that can be relevant.
  • I've explained the steps to reproduce the error or the motivation/use case of the question/suggestion.
@lasote
Copy link
Contributor

lasote commented Aug 27, 2018

but are providing Findlibpq.cmake

Why? due to cmake_find_package generator or the cmake file is while package?

@memsharded
Copy link
Member

Yes, please clarify the package name and the filenames issues.

@uilianries
Copy link
Member Author

uilianries commented Aug 27, 2018 via email

@lasote
Copy link
Contributor

lasote commented Aug 27, 2018

So if I want to run find_package(PostgreSQL) and use our libpq package,
it won't work.

Why? The CMAKE_MODULE_PATH and CMAKE_PREFIX_PATH are automatically set, so the https://github.com/Kitware/CMake/blob/master/Modules/FindPostgreSQL.cmake should be found correctly without any special setup, just the cmake generator.

@uilianries
Copy link
Member Author

Sorry, I forgot to mention that I'm not able to change the CMakeLists.txt, I only see cmake_paths and cmake_find_packages as possible options, because the cmake generator needs conan_basic_setup

Now the full context, I'm trying to finish taocpp/postgres. I would like to avoid changing the cmake file. The taocpp-postgres.cmake#L9 includes PostgreSQL as cmake package. But if I use libpq/9.6.9@conan/stable by cmake_paths or cmake_find_packages, all paths are set using CONAN_libpq so it's not possible to find PostgreSQL.

@lasote
Copy link
Contributor

lasote commented Aug 28, 2018

I see. If you cannot even patch the CMakeLists (replace_in_file), currently, it is not possible.
There are two possibilities (future features that could help):

a) Being able to receive parameters in the generators, for the cmake_find_packages is not the first time it is requested. One of the parameters could be the name of the file to be generated. But it requires a feature that needs to be carefully designed.

b) I dedicated some time to a new model of the cmake generator/build_helper and apparently (very preliminary tests) it might be possible to automatically inject the needed code using a toolchain -T somefile.cmake. But if finally it becomes a real feature it will take time, maybe even Conan 2.0.

I think we should implement both a and b, but we have no ETA for none of them.

@uilianries
Copy link
Member Author

Thanks for your advice! I really enjoyed the discussion.

No problem about the features, but is good to know about it :)

I could run replace_in_file, but is an workaround.

I'll provide FindPostgreSQL.cmake directly from libpq package, overriding all libraries and headers path. I see as a dirty option, but the client will not suffer any change.

@lasote
Copy link
Contributor

lasote commented Aug 29, 2018

I usually dislike providing a custom FindPostgreSQL.cmake because CMake releases commonly included new features in the scripts, like targets and so on, so it is very difficult to maintain.

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

No branches or pull requests

3 participants