Skip to content

Commit

Permalink
[CMake] Don't update compile definitions for imported targets for MSCV (
Browse files Browse the repository at this point in the history
#18766)

If one uses `-DIREE_BUILD_BUNDLED_LLVM=OFF` then targets for some
libraries become imported/`INTERFACE` and CMake doesn't let you update
their `target_compile_definitions`. I.e., CMake errors out (not that it
would work anyway). So just check and skip in that case.
  • Loading branch information
makslevental authored Oct 15, 2024
1 parent 6295784 commit 9f93073
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion compiler/src/iree/compiler/API/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ foreach(_object_lib ${_EXPORT_OBJECT_LIBS})
# It isn't super polite to be poking at other people's library definitions
# like this, but MSVC is weird and given the structure of the projects, this
# isn't so bad.
if(MSVC)
get_target_property(_imported ${_object_lib} IMPORTED)
if(MSVC AND NOT ${_imported})
target_compile_definitions(${_object_lib} PRIVATE
# See compiler/bindings/c/iree/compiler/api_support.h.
# IREE embedded CAPI uses its own macros to enable
Expand Down

0 comments on commit 9f93073

Please sign in to comment.