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

Fix CMake compile flags definition. #398

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jdumas
Copy link

@jdumas jdumas commented Aug 31, 2022

When building embree as a subproject (via add_subdirectory()) and as a static library on Windows, I do get a bunch of errors of the sort:

error LNK2019: unresolved external symbol __imp_rtcNewDevice referenced in function XXX

This is because the compile flag EMBREE_STATIC_LIB is only defined for embree files (such as rtcore.cpp), but is NOT propagated transitively to downstream targets. The reason is that Embree's CMake uses the deprecated construct add_definitions(), which adds flags to a folder property. The modern CMake way to do this is to work with target properties instead, attaching compile flags to targets and properly express which ones should be transitively propagated (PUBLIC or INTERFACE properties).

This PR remedies this shortcoming by attaching all compilation flags to a new INTERFACE target embree_config, which will properly propagate the information to downstream targets.

@jdumas
Copy link
Author

jdumas commented Oct 11, 2022

@svenwoop can we get any feedback on this PR please?

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.

1 participant