Carlo Bramini a6ea0185d6 [llvm] CYGWIN: Fix build of some plugins/library/unittests
CYGWIN uses the same format of WIN32 for shared libraries.
As the comment says: "a shared library can't have undefined references", in this case CYGWIN must be handled like WIN32 by CMakeLists.txt, otherwise you will get several errors when linking because some symbols are undefined.
Attached patch fixes this issue and allows to complete the build process for those targets.

Differential Revision: https://reviews.llvm.org/D154794
2023-07-10 22:43:03 +03:00

20 lines
739 B
CMake

if(LLVM_EXAMPLEIRTRANSFORMS_LINK_INTO_TOOLS)
message(WARNING "Setting LLVM_EXAMPLEIRTRANSFORMS_LINK_INTO_TOOLS=ON only makes sense for testing purpose")
endif()
# The plugin expects to not link against the Support and Core libraries,
# but expects them to exist in the process loading the plugin. This doesn't
# work with DLLs on Windows (where a shared library can't have undefined
# references), so just skip this example on Windows.
if (NOT WIN32 AND NOT CYGWIN)
add_llvm_pass_plugin(ExampleIRTransforms
SimplifyCFG.cpp
DEPENDS
intrinsics_gen
BUILDTREE_ONLY
)
install(TARGETS ${name} RUNTIME DESTINATION "${LLVM_EXAMPLES_INSTALL_DIR}")
set_target_properties(${name} PROPERTIES FOLDER "Examples")
endif()