-
Notifications
You must be signed in to change notification settings - Fork 444
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 include search for Z3 in testgen library #4012
Conversation
Hmm, let me think about this. Z3 is already a publicly linked library in p4tools-common, so I am not sure why this fails. We will definitely need the add_dependencies call to ensure build order remains consistent in parallel builds. The intent for |
It fails because there is nothing connecting
I think the
In that case I suggest explicitly linking |
…(including those from external targets)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for fixing this. We also install a custom version of Z3, but we install it in /usr/local/lib
, which does not seem to run into these issues.
Maybe it is worthwhile to use fetchcontent to install Z3 explicitly to avoid these errors going forward. Just like we do with Inja.
Co-authored-by: Fabian Ruffy <[email protected]>
Yes, that would be found by default I think.
Maybe as a fallback we could. I think we should allow using system libs too (also for inja), but that is another topic. |
@fruffy The change in 38ba8df#diff-b2d8f4059a838269ba2d86ef0f39a84301da327327cd0415e56e7e6d68507e92R117 broke build of testgen on systems where Z3 does not have includes in the default system directory. The reason is that
add_dependencies
only affects ordering, not include-/link- search paths. Instead if I set the (static)testgen
library to be linked to Z3 andinja
with thePUBLIC
option it will mean that both the library itself, and anything that it is linked to will see the include paths for both Z3 and inja and any resulting binaries will be linked to both. This not only fixes the problem, but it is also cleaner (except for the cmake weirdness thattarget_link_libraries
affects both include- and link-search, but that it a feature of cmake itself).