Skip to content
This repository was archived by the owner on Apr 15, 2020. It is now read-only.

Comments

Fix location of version_not_found check#1342

Merged
ruslo merged 2 commits intoruslo:masterfrom
elucideye:pr.hunter_download.version_not_found.placement
Feb 4, 2018
Merged

Fix location of version_not_found check#1342
ruslo merged 2 commits intoruslo:masterfrom
elucideye:pr.hunter_download.version_not_found.placement

Conversation

@headupinclouds
Copy link
Contributor

  • I've checked this Git style guide. [Yes]
  • I've checked this CMake style guide. [Yes]
  • My change will work with CMake 3.0 (minimum requirement for Hunter). [Yes]
  • I will try to keep this pull request as small as possible and will try not to mix unrelated features. [Yes]

If a hunter_config() call specifies a VERSION that isn’t defined by a hunter_add_version() call (hunter/cmake//hunter.cmake), perhaps due to a typo, then a call to hunter_download_server_url() will be made with an empty VERSION, and the reported error looks like this:

-- [hunter *** DEBUG *** 2018-02-03T17:12:33] Foo versions available: [1.0.9999999]

[hunter ** INTERNAL **] 'hunter_download_server_url' incorrect usage
[hunter ** INTERNAL **]  option 'SHA1' with one argument is mandatory.

In this case may have asked for something like hunter_config(Foo VERSION 1.0.0), or a typo hunter_config(FOO VERSION 1.0.0y), but only a valid VERSION 1.0.9999999 exists.

This PR moves the existing HUNTER_PACKAGE_SHA1 version_not_found test above the call to hunter_download_server_url(), such that a more intuitive error is reported with the strong: "Version not found: ${ver}. See 'hunter_config' command."

With this change, the log listed above then becomes more human readable:

-- [hunter *** DEBUG *** 2018-02-03T17:15:09] FunctionalPlus versions available: [1.0.9999999]

[hunter ** FATAL ERROR **] Version not found: 1.0.0. See 'hunter_config' command.

and the developer can more easily diagnose and fix the source of the VERSION mismatch error.

If a hunter_config() call specifies a VERSION that isn’t defined in a hunter_add_version() call (hunter/cmake/<package>/hunter.cmake), then a call to hunter_download_server_url() is made with an empty VERSION, and the reported error looks like this:

```
-- [hunter *** DEBUG *** 2018-02-03T17:12:33] FunctionalPlus versions available: [B.A.D]

[hunter ** INTERNAL **] 'hunter_download_server_url' incorrect usage
[hunter ** INTERNAL **]  option 'SHA1' with one argument is mandatory.
```

This PR moves the existing HUNTER_PACKAGE_SHA1 version_not_found test above the call to hunter_download_server_url, such that the more intuitive error:

```
"Version not found: ${ver}. See 'hunter_config' command.")
```

occurs first, instead of the indirect error that is reported inside hunter_download_server_url.

The error then becomes more human readable:

```
-- [hunter *** DEBUG *** 2018-02-03T17:15:09] FunctionalPlus versions available: [B.A.D]

[hunter ** FATAL ERROR **] Version not found: 1.0.0. See 'hunter_config' command.
```
@ruslo ruslo merged commit 7c61ec9 into ruslo:master Feb 4, 2018
@ruslo
Copy link
Owner

ruslo commented Feb 4, 2018

@headupinclouds headupinclouds deleted the pr.hunter_download.version_not_found.placement branch March 11, 2018 13:57
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants