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

[REQUEST] Link against specific Boost libraries rather than Boost::headers and Boost::boost #1819

Open
vasil-pashov opened this issue May 16, 2024 · 0 comments

Comments

@vasil-pashov
Copy link

Is your feature request related to a problem? Please describe.

Currently, OpenVDB links against Boost::headers. This works because when boost is installed it puts all headers in the same folder and Boost::headers is just an interface target with target_include_directories set to that folder. If boost is used as a subdirectory Boost::headers is not created, moreover, different boost libraries are in different folders, thus even if Boost::headers was defined it would have more than 150 include directories (this issue is discussed here). This makes it hard to use Boost without installing it (e.g. using CMake FetchContent to get the dependency). Which also makes it hard to get started with OpenVDB.

Describe the solution you'd like

Link to the specific targets OpenVDB uses instead of linking to Boost::headers. To my knowledge, OpenVDB uses Boost::numeric_conversion and Boost::interprocess. This would also make it more trackable and people would know which components of Boost are needed instead of fetching the whole thing.

Describe alternatives you've considered

Adding openvdb-extra.cmake with the proper target_link_libraries calls after FetchContent_Declare fixes the issue, but it's not obvious that people should do that. It also pollutes the project and doesn't look future-proof.

FetchContent_Declare(
	openvdb
	URL https://github.com/AcademySoftwareFoundation/openvdb/archive/refs/tags/v11.0.0.zip
	OVERRIDE_FIND_PACKAGE
	EXCLUDE_FROM_ALL
)
file(WRITE ${CMAKE_FIND_PACKAGE_REDIRECTS_DIR}/openvdb-extra.cmake
[=[
	if(TARGET openvdb_static)
		target_link_libraries(openvdb_static PRIVATE Boost::numeric_conversion Boost::interprocess)
	endif()
	if(TARGET openvdb_shared)
		target_link_libraries(openvdb_shared PRIVATE Boost::numeric_conversion Boost::interprocess)
	endif()
]=])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant