Skip to content

Fix compatibility with CMake < 3.0#54

Open
HeroCC wants to merge 1 commit intothemoos:masterfrom
HeroCC:cmake2fixes
Open

Fix compatibility with CMake < 3.0#54
HeroCC wants to merge 1 commit intothemoos:masterfrom
HeroCC:cmake2fixes

Conversation

@HeroCC
Copy link
Copy Markdown
Contributor

@HeroCC HeroCC commented Jul 8, 2019

The CMakeFindDependencyMacro is a 3.0 feature, while core-moos supports as low as CMake 2.8. The issue isn't apparent when building core-moos alone, however, when a dependent project (say, essential-moos) tries to use it an error is produced, citing the lack of CMakeFindDependencyMacro, and therefore find_dependency. This commit uses the slightly different find_package function, which is supported on CMake 2.8 systems.

To reproduce, boot a system with CMake 2.8 (I'm using CentOS 7), clone both core-moos and essential-moos, cmake && make core-moos (there shouldn't be any errors), then try to cmake essential-moos. The error should present itself.

The alternative to this patch is to explicitly set 3.0 as the minimum requirement, though this may have negative impact on downstream projects.

Testing would be appreciated from whoever can.

Thanks!

The CMakeFindDependencyMacro is a 3.0 feature, while core-moos supports as low as [CMake 2.8](https://github.com/themoos/core-moos/blob/64c9750f53b0d049a4cd9ec771bc1dc397a9fb65/CMakeLists.txt\#L7). The issue isn't apparent when building core-moos alone, however, when a dependent project (say, essential-moos) tries to use it an error is produced, citing the lack of CMakeFindDependencyMacro, and therefore find_dependency. This commit uses the slightly different find_package function, which is supported on CMake 2.8 systems.
Copy link
Copy Markdown
Contributor

@alastair-harrison-oxb alastair-harrison-oxb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like a reasonable change if the switch to a newer version of CMake is not possible/desirable.

AFAIK find_dependency does the same thing as find_package but additionally respects any QUIET flag sent to the enclosing find_package call to suppress log output.

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.

3 participants