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

cmake: Fix the option to disable man pages #2161

Merged
merged 3 commits into from
Jan 21, 2024

Conversation

blabber
Copy link
Collaborator

@blabber blabber commented Jan 19, 2024

Fxes the handling of the FREECIV_ENABLE_MANPAGES option, leveraging the fact, that an option call is a no-op if the value is already set.

We also allow users on non-Unix systems to build manpages (for whatever reason one may want to do that).

Closes #2155

This needs a thorough review as I am non-fluent in cmake and don't have non-Unix systems available to test.

This commit fixes the handling of the `FREECIV_ENABLE_MANPAGES` option,
leveraging the fact, that an `option` call is a no-op if the value is
already set.

While here, allow users on non-Unix systems to build manpages.

Closes longturn#2155
@jwrober jwrober self-requested a review January 20, 2024 00:08
@jwrober
Copy link
Collaborator

jwrober commented Jan 20, 2024

Well I started as non-fluent in Cmake too and I've got a lot of changes made over time. It grows on ya. Thanks for the PR. I'll have a look soon.

@lmoureaux lmoureaux self-requested a review January 20, 2024 16:52
Copy link
Contributor

@lmoureaux lmoureaux left a comment

Choose a reason for hiding this comment

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

I think we need to consider the following cases (assuming UNIX to simplify):

  1. The user doesn't configure anything special and has sphinx. In this case we want to build man pages. This is working.
  2. The user doesn't configure anything special and doesn't have sphinx. In this case we don't want to build man pages. This is working. (I think the option should still be defined in this case though, just default to OFF.)
  3. The user sets FREECIV_ENABLE_MANPAGES to OFF. In this case we don't want to build the pages. This is working.
  4. The user sets FREECIV_ENABLE_MANPAGES to ON and has sphinx. In this case we want to build man pages. This is working.
  5. The user sets FREECIV_ENABLE_MANPAGES to OFF and doesn't have sphinx. In this case we want to build man pages but we can't and should emit an error at configure time. Currently we silently ignore the option.

To support 5 one would simply call find_package(sphinx REQUIRED) whenever FREECIV_ENABLE_MANPAGES is ON.

@jwrober
Copy link
Collaborator

jwrober commented Jan 20, 2024

@blabber see @lmoureaux's comments. Let's support option 5 in the PR to make it complete.

If the user requests to build manpages by setting
`FREECIV_ENABLE_MANPAGES` to `ON`, `sphinx` is now treated as a hard
dependency.

While here simplify the code and re-add the default option set to `OFF`,
as requested per review.
@lmoureaux
Copy link
Contributor

Thanks for the fix!

@lmoureaux lmoureaux merged commit 5366836 into longturn:master Jan 21, 2024
20 checks passed
@blabber blabber deleted the bugfix/fix_FREECIV_ENABLE_MANPAGES branch January 21, 2024 17:50
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.

Sphinx: Unable to disable making man pages
3 participants