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: Add customizable target names for compression libraries #176

Merged
merged 2 commits into from
Sep 2, 2024

Conversation

tarun-t
Copy link
Contributor

@tarun-t tarun-t commented Aug 29, 2024

  • Introduce CACHE variables for ZLIB, BZip2, LibLZMA, and Zstd targets
  • Update boost_iostreams_option function calls to use new variables

- Introduce CACHE variables for ZLIB, BZip2, LibLZMA, and Zstd targets
- Update boost_iostreams_option function calls to use new variables
@tarun-t
Copy link
Contributor Author

tarun-t commented Aug 30, 2024

@pdimov @mclow Drawing your attention to this PR. I am happy to do it any other way if required.

@pdimov
Copy link
Member

pdimov commented Aug 30, 2024

You probably need to tell us what's the purpose of this change.

@tarun-t
Copy link
Contributor Author

tarun-t commented Aug 31, 2024

This change introduces configurable target names for compression libraries used by Boost.Iostreams. The main driver is to allow static linking with zstd, which isn't possible with the current hardcoded zstd::libzstd_shared target. By making target names user-configurable via cache variables, we provide flexibility for different build environments and library configurations without breaking existing setups.

@pdimov
Copy link
Member

pdimov commented Aug 31, 2024

Looks like this has already been proposed in #173.

So, the only use case is changing the zstd target name from zstd::libstd_shared to zstd::libstd_static? In that case, the rest of the target variables should be removed, and I think we also need to list the values of BOOST_IOSTREAMS_ZSTD_TARGET.

Note that these target names are referenced here

https:/boostorg/cmake/blob/bb741d09d2cb12f3934896880c6ecaf6de4ba707/include/BoostInstall.cmake#L367-L381

so that the installed config files add the appropriate find_dependency call. It looks like ztsd::libstd_static is already handled there because of boostorg/cmake#59.

@tarun-t
Copy link
Contributor Author

tarun-t commented Aug 31, 2024

Thank you for the feedback, @pdimov. I've updated the PR based on your suggestions:

  • Simplified the changes to focus on the zstd target name
  • Added an explicit list of possible values for BOOST_IOSTREAMS_TARGET_ZSTD
  • Implemented error checking to ensure only valid values are used

This change allows users to choose between shared and static zstd libraries by setting BOOST_IOSTREAMS_TARGET_ZSTD, with proper validation to prevent incorrect values.

Please let me know if you need any further modifications or clarifications.

@pdimov pdimov merged commit 641c8fd into boostorg:develop Sep 2, 2024
54 checks passed
@tarun-t tarun-t deleted the target-support branch September 3, 2024 03:29
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.

2 participants