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

Improve the CMake config files #2315

Merged
merged 5 commits into from Feb 24, 2021

Conversation

pinotree
Copy link
Contributor

@pinotree pinotree commented Jan 3, 2021

Use the modern CMake macros to produce config files that properly work (hopefully). This also makes it possible to deprecate the OpenBabel3_INCLUDE_DIRS & OpenBabel3_LIBRARIES public CMake variables, and use only the openbabel imported library.

This fixes #2264.
This fixes #2305.

Make use of the CMakePackageConfigHelpers (available already in cmake
3.1) to generate the OpenBabel3ConfigVersion.cmake file completely,
and get rid of the local version.

Mostly important, use CMakePackageConfigHelpers also for generating
the bulk of OpenBabel3Config.cmake: the standard boilerplate from cmake
is inserted, and that takes care of properly locating all the various
paths from the installation directories.

Fixes openbabel#2264.
Mark all the library dependencies of the openbabel library as private:
this way, they will not be considered public interface, and thus neither
used when linking to the openbabel library within openbabel itself, nor
exposed in the cmake config file with the openbabel targets.

Fixes openbabel#2305.
Set the include directories as public include interfaces of the
openbabel library: this way they will be written in the cmake config
file with the openbabel targets, and thus used when using the
"openbabel" imported library.
Switch the OpenBabel3_INCLUDE_DIRS & OpenBabel3_LIBRARIES variables
of the cmake config file to use the imported "openbabel" library:
using that library alone is enough to get the include directories and
the right library path; e.g.:

  target_link_library(mytarget openbabel)
Stop telling people to write their cmake find module, it is not useful
with the provided cmake configuration files.
@ghutchis
Copy link
Member

Thanks. Considering I have to go through CMake documentation anytime I have to fix some of this, it's greatly appreciated. And I agree it's probably time to move to 3.1 or later.

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 this pull request may close these issues.

Cmake fails to find imported targets maeparser and coordgen CMake is unable to find Open Babel installation
3 participants