[GC-STAGING] Filter out LLVM_DEFINITIONS that were already defined
#898
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I don't know why, but
LLVM_DEFINITIONSvariable (that is populated byfind_package(llvm...)) contains all compile definitions that were added prior callingfind_package(llvm...)when I build IMEX with OpenVino.In particular,
LLVM_DEFINITIONScontains-DOV_BUILD_POSTFIX=...and-DOV_BUILD_PATH=...variables that were already defined by OV which causes the IMEX build to fail due to double definition (because they were already added asadd_definitions()on OV side and now we're trying to add them again in IMEX).There's nothing special of how those two variables are defined in OV. In fact, any variable that is added as
add_definitions(...)oradd_compile_definitions(...)prior callingFetchContent_Declare(GC, ...)in OV is being propagated toLLVM_DEFINITIONS.To fix this, I've added a logic that goes through every variable in
LLVM_DEFINITIONSand checks if it was already defined.p.s.
This problem is not IMEX specific. In GC the OV variables are also propagated to
LLVM_DEFINITIONS. However in GC we're addingLLVM_DEFINITIONSas compile options rather than as compile definitions, which works just fine.@AndreyPavlenko @kurapov-peter is there a better fix for this or we can merge this one?